Fixes to closing torrents and connections

This commit is contained in:
Matt Joiner 2014-08-28 10:04:44 +10:00
parent 1507d803bd
commit e09e21fab2
1 changed files with 2 additions and 4 deletions

View File

@ -267,9 +267,7 @@ func (me *Client) Stop() {
close(me.quit)
me.event.Broadcast()
for _, t := range me.torrents {
for _, c := range t.Conns {
c.Close()
}
t.Close()
}
me.mu.Unlock()
}
@ -929,10 +927,10 @@ func (me *Client) connectionLoop(t *torrent, c *connection) error {
}
func (me *Client) dropConnection(torrent *torrent, conn *connection) {
conn.Socket.Close()
for r := range conn.Requests {
me.connDeleteRequest(torrent, conn, r)
}
conn.Close()
for i0, c := range torrent.Conns {
if c != conn {
continue