mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
added missing shutdown of non responsive socket that could leak FDs (suggested by GuessWho
This commit is contained in:
parent
39672b2df6
commit
f1f722a767
1 changed files with 7 additions and 0 deletions
|
@ -123,6 +123,10 @@ int pqissllistenbase::setuplisten()
|
|||
err = fcntl(lsock, F_SETFL, O_NONBLOCK);
|
||||
if (err < 0)
|
||||
{
|
||||
shutdown(lsock,SHUT_RDWR) ;
|
||||
close(lsock) ;
|
||||
lsock = -1 ;
|
||||
|
||||
std::string out;
|
||||
rs_sprintf(out, "Error: Cannot make socket NON-Blocking: %d", err);
|
||||
pqioutput(PQL_ERROR, pqissllistenzone, out);
|
||||
|
@ -145,6 +149,9 @@ int pqissllistenbase::setuplisten()
|
|||
unsigned long int on = 1;
|
||||
if (0 != (err = ioctlsocket(lsock, FIONBIO, &on)))
|
||||
{
|
||||
closesocket(lsock) ;
|
||||
lsock = -1 ;
|
||||
|
||||
std::string out;
|
||||
rs_sprintf(out, "pqissllistenbase::setuplisten() Error: Cannot make socket NON-Blocking: %d\n", err);
|
||||
out += "Socket Error: " + socket_errorType(WSAGetLastError());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue