Skip to content

Commit

Permalink
Fix segfault on nil conntrack.EntryHandle instance when dialing
Browse files Browse the repository at this point in the history
Fixes #314. Comments were added to the the conntrack package master, but have no functional change required here.
  • Loading branch information
anacrolix committed Apr 10, 2019
1 parent d478888 commit bc24973
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion client.go
Expand Up @@ -521,8 +521,13 @@ func (cl *Client) dialFirst(ctx context.Context, addr string) dialResult {
"dial torrent client",
0,
)
// Try to avoid committing to a dial if the context is complete as it's
// difficult to determine which dial errors allow us to forget the connection
// tracking entry handle.
if ctx.Err() != nil {
cte.Forget()
if cte != nil {
cte.Forget()
}
resCh <- dialResult{}
return
}
Expand Down

0 comments on commit bc24973

Please sign in to comment.