|
|
136d7b |
diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx
|
|
|
136d7b |
--- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait 2013-05-23 12:20:35.836386218 +0100
|
|
|
136d7b |
+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx 2013-05-23 12:23:04.698003213 +0100
|
|
|
136d7b |
@@ -325,18 +325,12 @@ bool TcpSocket::cork(int sock, bool enab
|
|
|
136d7b |
#endif
|
|
|
136d7b |
}
|
|
|
136d7b |
|
|
|
136d7b |
-bool TcpSocket::isSocket(int sock)
|
|
|
136d7b |
+bool TcpSocket::isListening(int sock)
|
|
|
136d7b |
{
|
|
|
136d7b |
- struct sockaddr_in info;
|
|
|
136d7b |
- socklen_t info_size = sizeof(info);
|
|
|
136d7b |
- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0;
|
|
|
136d7b |
-}
|
|
|
136d7b |
-
|
|
|
136d7b |
-bool TcpSocket::isConnected(int sock)
|
|
|
136d7b |
-{
|
|
|
136d7b |
- struct sockaddr_in info;
|
|
|
136d7b |
- socklen_t info_size = sizeof(info);
|
|
|
136d7b |
- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0;
|
|
|
136d7b |
+ int listening = 0;
|
|
|
136d7b |
+ socklen_t listening_size = sizeof(listening);
|
|
|
136d7b |
+ return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening,
|
|
|
136d7b |
+ &listening_size) >= 0 && listening;
|
|
|
136d7b |
}
|
|
|
136d7b |
|
|
|
136d7b |
int TcpSocket::getSockPort(int sock)
|
|
|
136d7b |
diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h
|
|
|
136d7b |
--- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait 2013-05-23 12:20:35.835386220 +0100
|
|
|
136d7b |
+++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h 2013-05-23 12:21:58.861730647 +0100
|
|
|
136d7b |
@@ -57,8 +57,7 @@ namespace network {
|
|
|
136d7b |
|
|
|
136d7b |
static bool enableNagles(int sock, bool enable);
|
|
|
136d7b |
static bool cork(int sock, bool enable);
|
|
|
136d7b |
- static bool isSocket(int sock);
|
|
|
136d7b |
- static bool isConnected(int sock);
|
|
|
136d7b |
+ static bool isListening(int sock);
|
|
|
136d7b |
static int getSockPort(int sock);
|
|
|
136d7b |
private:
|
|
|
136d7b |
bool closeFd;
|
|
|
136d7b |
diff -up tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc
|
|
|
136d7b |
--- tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait 2013-03-14 17:11:22.000000000 +0000
|
|
|
136d7b |
+++ tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc 2013-05-23 12:21:10.545530308 +0100
|
|
|
136d7b |
@@ -225,8 +225,7 @@ void vncExtensionInit()
|
|
|
136d7b |
network::TcpListener* listener = 0;
|
|
|
136d7b |
network::TcpListener* httpListener = 0;
|
|
|
136d7b |
if (scr == 0 && vncInetdSock != -1) {
|
|
|
136d7b |
- if (network::TcpSocket::isSocket(vncInetdSock) &&
|
|
|
136d7b |
- !network::TcpSocket::isConnected(vncInetdSock))
|
|
|
136d7b |
+ if (network::TcpSocket::isListening(vncInetdSock))
|
|
|
136d7b |
{
|
|
|
136d7b |
listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true);
|
|
|
136d7b |
vlog.info("inetd wait");
|