Пример #1
0
        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);
        }
Пример #2
0
 internal SwarmSession(SwarmConnect inner)
 {
     this.inner = inner;
 }