Fixes to closing torrents and connections
This commit is contained in:
parent
1507d803bd
commit
e09e21fab2
|
@ -267,9 +267,7 @@ func (me *Client) Stop() {
|
||||||
close(me.quit)
|
close(me.quit)
|
||||||
me.event.Broadcast()
|
me.event.Broadcast()
|
||||||
for _, t := range me.torrents {
|
for _, t := range me.torrents {
|
||||||
for _, c := range t.Conns {
|
t.Close()
|
||||||
c.Close()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
me.mu.Unlock()
|
me.mu.Unlock()
|
||||||
}
|
}
|
||||||
|
@ -929,10 +927,10 @@ func (me *Client) connectionLoop(t *torrent, c *connection) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (me *Client) dropConnection(torrent *torrent, conn *connection) {
|
func (me *Client) dropConnection(torrent *torrent, conn *connection) {
|
||||||
conn.Socket.Close()
|
|
||||||
for r := range conn.Requests {
|
for r := range conn.Requests {
|
||||||
me.connDeleteRequest(torrent, conn, r)
|
me.connDeleteRequest(torrent, conn, r)
|
||||||
}
|
}
|
||||||
|
conn.Close()
|
||||||
for i0, c := range torrent.Conns {
|
for i0, c := range torrent.Conns {
|
||||||
if c != conn {
|
if c != conn {
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue