Skip to content

Commit 5e972fc

Browse files
committed
libvncserver: httpd: don't log accept() errors
1 parent 540332b commit 5e972fc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/libvncserver/httpd.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,15 +229,20 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
229229
|| (rfbScreen->httpListen6Sock != RFB_INVALID_SOCKET && FD_ISSET(rfbScreen->httpListen6Sock, &fds))) {
230230
if (rfbScreen->httpSock != RFB_INVALID_SOCKET) rfbCloseSocket(rfbScreen->httpSock);
231231

232+
/*
233+
* Mirror the RFB listener in listenerRun(): on a failed accept() just bail and
234+
* keep the listening socket. While the bound interface's address is gone the
235+
* accept() fails (e.g. EINVAL), but the socket is not dead -- it resumes once
236+
* the address returns. Logging every failure here would flood the log for the
237+
* whole down period, so stay silent like the RFB path does.
238+
*/
232239
if(FD_ISSET(rfbScreen->httpListenSock, &fds)) {
233240
if ((rfbScreen->httpSock = accept(rfbScreen->httpListenSock, (struct sockaddr *)&addr, &addrlen)) == RFB_INVALID_SOCKET) {
234-
rfbLogPerror("httpCheckFds: accept");
235241
return;
236242
}
237243
}
238244
else if(FD_ISSET(rfbScreen->httpListen6Sock, &fds)) {
239245
if ((rfbScreen->httpSock = accept(rfbScreen->httpListen6Sock, (struct sockaddr *)&addr, &addrlen)) == RFB_INVALID_SOCKET) {
240-
rfbLogPerror("httpCheckFds: accept");
241246
return;
242247
}
243248
}

0 commit comments

Comments
 (0)