Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sould i send trackers? #6

Open
Alword opened this issue Jul 9, 2018 · 1 comment
Open

Sould i send trackers? #6

Alword opened this issue Jul 9, 2018 · 1 comment

Comments

@Alword
Copy link

Alword commented Jul 9, 2018

As we can see here; - params string[] trackers! it's cool

  public Task<SwarmSession> ConnectAsync(FileHash hash, params string[] trackers)
        {
            runtime.Start();

            SwarmConnect connect = new SwarmConnect
            {
                Hash = hash,
                Settings = settings,
                Localhost = PeerHash.Random(),
                Notifications = new NotificationCollection(),
                Completion = new TaskCompletionSource<SwarmSession>(),
                Peers = new HashSet<PeerHash>(),
                Remotes = new HashSet<NetworkAddress>(),
                Pipeline = runtime.Pipeline,
                Files = runtime.Files,
                Worker = runtime.Worker
            };

            connect.Start();
            connect.Announce(trackers);

            return connect.Completion.Task;
        }

there

But in user-tool and SwarmHelper
public static async Task DownloadAsync(string destination, FileHash hash, string tracker, NotificationCallback callback)
        {
            using (SwarmClient client = new SwarmClient())
            {
                Notification notification;
                SwarmSession session = await client.ConnectAsync(hash, tracker);

                session.Download(destination);

                while (true)
                {
                    notification = await session.NextAsync();
                    callback?.Invoke(notification);

                    if (notification.Type == NotificationType.DataCompleted)
                        break;
                }
            }
        }

there

string tracker (just one? too sad)
Great library, can u fix that or pull sombody (how can i pull, i am beginner)
I think it will be good update!

@ImVexed
Copy link

ImVexed commented Jul 12, 2018

As you've already seen, params string[] trackers is the second parameter for ConnectAsync, the only change that would have to be made is to modify DownloadAsync & change string tracker to params string[] trackers.

Just fork the repo, make the change, and make a pull request on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants