Newer
Older
Daniel Stenberg
committed
}
logmsg("====> Client connect");
msgsock = sock; /* use this as stream */
}
else {
/* passive daemon style */
sock = sockdaemon(sock, &port);
if(CURL_SOCKET_BAD == sock)
msgsock = CURL_SOCKET_BAD; /* no stream socket yet */
Daniel Stenberg
committed
}
logmsg("Running %s version", ipv_inuse);
Daniel Stenberg
committed
if(connectport)
logmsg("Connected to port %hu", connectport);
Daniel Stenberg
committed
else
logmsg("Listening on port %hu", port);
Daniel Stenberg
committed
wrotepidfile = write_pidfile(pidname);
if(!wrotepidfile)
goto sockfilt_cleanup;
do {
juggle_again = juggle(&msgsock, sock, &mode);
} while(juggle_again);
Daniel Stenberg
committed
sockfilt_cleanup:
if((msgsock != sock) && (msgsock != CURL_SOCKET_BAD))
sclose(msgsock);
if(sock != CURL_SOCKET_BAD)
unlink(pidname);
restore_signal_handlers();
if(got_exit_signal) {
logmsg("============> sockfilt exits with signal (%d)", exit_signal);
/*
* To properly set the return status of the process we
* must raise the same signal SIGINT or SIGTERM that we
* caught and let the old handler take care of it.
*/
raise(exit_signal);
}
Daniel Stenberg
committed
logmsg("============> sockfilt quits");