return
}
+func (cl *Client) waitAccept() {
+ cl.mu.Lock()
+ defer cl.mu.Unlock()
+ for {
+ for _, t := range cl.torrents {
+ if cl.wantConns(t) {
+ return
+ }
+ }
+ cl.event.Wait()
+ }
+}
+
func (cl *Client) acceptConnections(l net.Listener, utp bool) {
for {
+ cl.waitAccept()
// We accept all connections immediately, because we don't know what
// torrent they're for.
conn, err := l.Accept()
}
func (me *Client) dropConnection(torrent *torrent, conn *connection) {
+ me.event.Broadcast()
for r := range conn.Requests {
me.connDeleteRequest(torrent, conn, r)
}