Annotation of /trunk/tigervnc/patches/tigervnc-1.3.0-inetd-nowait.patch
Parent Directory | Revision Log
Revision 2252 -
(hide annotations)
(download)
Mon Aug 12 09:25:56 2013 UTC (11 years, 1 month ago) by niro
File size: 2636 byte(s)
Mon Aug 12 09:25:56 2013 UTC (11 years, 1 month ago) by niro
File size: 2636 byte(s)
-add patches for 1.3.0
1 | niro | 2252 | diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx |
2 | --- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx.inetd-nowait 2013-05-23 12:20:35.836386218 +0100 | ||
3 | +++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.cxx 2013-05-23 12:23:04.698003213 +0100 | ||
4 | @@ -325,18 +325,12 @@ bool TcpSocket::cork(int sock, bool enab | ||
5 | #endif | ||
6 | } | ||
7 | |||
8 | -bool TcpSocket::isSocket(int sock) | ||
9 | +bool TcpSocket::isListening(int sock) | ||
10 | { | ||
11 | - struct sockaddr_in info; | ||
12 | - socklen_t info_size = sizeof(info); | ||
13 | - return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0; | ||
14 | -} | ||
15 | - | ||
16 | -bool TcpSocket::isConnected(int sock) | ||
17 | -{ | ||
18 | - struct sockaddr_in info; | ||
19 | - socklen_t info_size = sizeof(info); | ||
20 | - return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0; | ||
21 | + int listening = 0; | ||
22 | + socklen_t listening_size = sizeof(listening); | ||
23 | + return getsockopt(sock, SOL_SOCKET, SO_ACCEPTCONN, &listening, | ||
24 | + &listening_size) >= 0 && listening; | ||
25 | } | ||
26 | |||
27 | int TcpSocket::getSockPort(int sock) | ||
28 | diff -up tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h | ||
29 | --- tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h.inetd-nowait 2013-05-23 12:20:35.835386220 +0100 | ||
30 | +++ tigervnc-1.2.80-20130314svn5065/common/network/TcpSocket.h 2013-05-23 12:21:58.861730647 +0100 | ||
31 | @@ -57,8 +57,7 @@ namespace network { | ||
32 | |||
33 | static bool enableNagles(int sock, bool enable); | ||
34 | static bool cork(int sock, bool enable); | ||
35 | - static bool isSocket(int sock); | ||
36 | - static bool isConnected(int sock); | ||
37 | + static bool isListening(int sock); | ||
38 | static int getSockPort(int sock); | ||
39 | private: | ||
40 | bool closeFd; | ||
41 | 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 | ||
42 | --- tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc.inetd-nowait 2013-03-14 17:11:22.000000000 +0000 | ||
43 | +++ tigervnc-1.2.80-20130314svn5065/unix/xserver/hw/vnc/vncExtInit.cc 2013-05-23 12:21:10.545530308 +0100 | ||
44 | @@ -225,8 +225,7 @@ void vncExtensionInit() | ||
45 | network::TcpListener* listener = 0; | ||
46 | network::TcpListener* httpListener = 0; | ||
47 | if (scr == 0 && vncInetdSock != -1) { | ||
48 | - if (network::TcpSocket::isSocket(vncInetdSock) && | ||
49 | - !network::TcpSocket::isConnected(vncInetdSock)) | ||
50 | + if (network::TcpSocket::isListening(vncInetdSock)) | ||
51 | { | ||
52 | listener = new network::TcpListener(NULL, 0, 0, vncInetdSock, true); | ||
53 | vlog.info("inetd wait"); |