Commit 963259de authored by Ian Craggs's avatar Ian Craggs

Merge branch 'socket-close' of https://github.com/JuergenKosel/paho.mqtt.c into fixes

parents 5571f9b1 7679314e
......@@ -689,6 +689,15 @@ int Socket_new(char* addr, int port, int* sock)
Log(TRACE_MIN, 15, "Connect pending");
}
}
/* Prevent socket leak by closing unusable sockets,
* as reported in
* https://github.com/eclipse/paho.mqtt.c/issues/135
*/
if (rc && (rc != EINPROGRESS) && (rc != EWOULDBLOCK))
{
Socket_close(*sock); // close socket and remove from our list of sockets
*sock = -1; // as initialized before
}
}
}
FUNC_EXIT_RC(rc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment