|
|
|
@ -260,7 +260,8 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
|
|
|
|
|
|
|
|
|
|
if (rfbScreen->listenSock != -1 && FD_ISSET(rfbScreen->listenSock, &fds)) {
|
|
|
|
|
|
|
|
|
|
rfbProcessNewConnection(rfbScreen);
|
|
|
|
|
if (!rfbProcessNewConnection(rfbScreen))
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
FD_CLR(rfbScreen->listenSock, &fds);
|
|
|
|
|
if (--nfds == 0)
|
|
|
|
@ -322,7 +323,7 @@ rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
rfbBool
|
|
|
|
|
rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
|
|
|
|
|
{
|
|
|
|
|
const int one = 1;
|
|
|
|
@ -333,19 +334,19 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
|
|
|
|
|
if ((sock = accept(rfbScreen->listenSock,
|
|
|
|
|
(struct sockaddr *)&addr, &addrlen)) < 0) {
|
|
|
|
|
rfbLogPerror("rfbCheckFds: accept");
|
|
|
|
|
return -1;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!rfbSetNonBlocking(sock)) {
|
|
|
|
|
closesocket(sock);
|
|
|
|
|
return -1;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
|
|
|
|
(char *)&one, sizeof(one)) < 0) {
|
|
|
|
|
rfbLogPerror("rfbCheckFds: setsockopt");
|
|
|
|
|
closesocket(sock);
|
|
|
|
|
return -1;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef USE_LIBWRAP
|
|
|
|
@ -354,13 +355,15 @@ rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
|
|
|
|
|
rfbLog("Rejected connection from client %s\n",
|
|
|
|
|
inet_ntoa(addr.sin_addr));
|
|
|
|
|
closesocket(sock);
|
|
|
|
|
return -1;
|
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr));
|
|
|
|
|
|
|
|
|
|
rfbNewClient(rfbScreen,sock);
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|