Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

socket leakage #304

Closed
robustor123 opened this issue Nov 7, 2016 · 2 comments
Closed

socket leakage #304

robustor123 opened this issue Nov 7, 2016 · 2 comments

Comments

@robustor123
Copy link

when reconnect is needed, previous socket is not closed.
as following modification, the _mosquitto_socket_close() function should be called.
with this fix, I can remove socket leakage problem in mosquitto library.

static int _mosquitto_reconnect(struct mosquitto *mosq, bool blocking)
{
...
#ifdef WITH_SOCKS
if(mosq->socks5_host){
rc = _mosquitto_socket_connect(mosq, mosq->socks5_host, mosq->socks5_port, mosq->bind_address, blocking);
}else
#endif
{
if(mosq->sock != INVALID_SOCKET){
_mosquitto_socket_close(mosq); //close socket
}
rc = _mosquitto_socket_connect(mosq, mosq->host, mosq->port, mosq->bind_address, blocking);
}

@thlassche
Copy link
Contributor

thlassche commented Nov 7, 2016

Pull request opened for this #307

thlassche added a commit to thlassche/mosquitto that referenced this issue Nov 7, 2016
Signed-off-by: Teun Lassche <[email protected]>
ralight pushed a commit that referenced this issue Dec 4, 2016
Signed-off-by: Teun Lassche <[email protected]>
ralight added a commit that referenced this issue Dec 4, 2016
@ralight ralight added this to the fixes-next milestone Dec 4, 2016
@ralight
Copy link
Contributor

ralight commented Dec 4, 2016

Thanks both, this is now fixed in the fixes branch.

@ralight ralight closed this as completed Dec 4, 2016
ralight pushed a commit that referenced this issue Feb 20, 2017
Signed-off-by: Teun Lassche <[email protected]>
ralight added a commit that referenced this issue Feb 20, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants