Browse Source

Close sock in connector loop after we've finished using it

master
Con Kolivas 11 years ago
parent
commit
20e056c4a1
  1. 3
      src/connector.c

3
src/connector.c

@ -447,6 +447,7 @@ static int connector_loop(proc_instance_t *pi, conn_instance_t *ci)
} }
} while (selret < 1); } while (selret < 1);
retry: retry:
close(sockd);
sockd = accept(us->sockd, NULL, NULL); sockd = accept(us->sockd, NULL, NULL);
if (sockd < 0) { if (sockd < 0) {
LOGERR("Failed to accept on connector socket, retrying in 5s"); LOGERR("Failed to accept on connector socket, retrying in 5s");
@ -455,7 +456,6 @@ retry:
} }
buf = recv_unix_msg(sockd); buf = recv_unix_msg(sockd);
close(sockd);
if (!buf) { if (!buf) {
LOGWARNING("Failed to get message in connector_loop"); LOGWARNING("Failed to get message in connector_loop");
goto retry; goto retry;
@ -507,6 +507,7 @@ retry:
goto retry; goto retry;
out: out:
close(sockd);
dealloc(buf); dealloc(buf);
return ret; return ret;
} }

Loading…
Cancel
Save