Avoiding leaving the socket open when an error occurs in multistream connect.
This commit is contained in:
parent
e4ba343d48
commit
e51643a8f4
1 changed files with 2 additions and 0 deletions
|
@ -171,6 +171,8 @@ struct Stream* libp2p_net_multistream_connect(const char* hostname, int port) {
|
||||||
libp2p_net_multistream_stream_free(stream);
|
libp2p_net_multistream_stream_free(stream);
|
||||||
stream = NULL;
|
stream = NULL;
|
||||||
}
|
}
|
||||||
|
if (retVal < 0 && socket > 0)
|
||||||
|
close(socket);
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue