diff options
author | Christian Beier <dontmind@freeshell.org> | 2016-11-20 14:56:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-20 14:56:15 +0100 |
commit | 01698f5c5be8fe7af08f8704f115344f6a0cac45 (patch) | |
tree | 30f0efdd5d1862a835cb84f898723ae3510faf39 /libvncserver | |
parent | 93ea516fd175a4f8e6810f183e5fed86489804c0 (diff) | |
parent | cdd81bd479e228724ef03bf94c42a34feb42145a (diff) | |
download | libtdevnc-01698f5c5be8fe7af08f8704f115344f6a0cac45.tar.gz libtdevnc-01698f5c5be8fe7af08f8704f115344f6a0cac45.zip |
Merge pull request #128 from zmedico/autoprobe-selective
Support autoPort with ipv4 or ipv6 disabled
Diffstat (limited to 'libvncserver')
-rw-r--r-- | libvncserver/sockets.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libvncserver/sockets.c b/libvncserver/sockets.c index d4822f4..bbc3d90 100644 --- a/libvncserver/sockets.c +++ b/libvncserver/sockets.c @@ -221,10 +221,10 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) return; } - if(rfbScreen->autoPort) { - int i; - FD_ZERO(&(rfbScreen->allFds)); + FD_ZERO(&(rfbScreen->allFds)); + if(rfbScreen->autoPort && rfbScreen->port>0) { + int i; rfbLog("Autoprobing TCP port \n"); for (i = 5900; i < 6000; i++) { if ((rfbScreen->listenSock = rfbListenOnTCPPort(i, iface)) >= 0) { @@ -241,8 +241,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) rfbLog("Autoprobing selected TCP port %d\n", rfbScreen->port); FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbScreen->listenSock; + } #ifdef LIBVNCSERVER_IPv6 + if(rfbScreen->autoPort && rfbScreen->ipv6port>0) { + int i; rfbLog("Autoprobing TCP6 port \n"); for (i = 5900; i < 6000; i++) { if ((rfbScreen->listen6Sock = rfbListenOnTCP6Port(i, rfbScreen->listen6Interface)) >= 0) { @@ -259,12 +262,11 @@ rfbInitSockets(rfbScreenInfoPtr rfbScreen) rfbLog("Autoprobing selected TCP6 port %d\n", rfbScreen->ipv6port); FD_SET(rfbScreen->listen6Sock, &(rfbScreen->allFds)); rfbScreen->maxFd = rfbMax((int)rfbScreen->listen6Sock,rfbScreen->maxFd); -#endif } - else - { +#endif + + if(!rfbScreen->autoPort) { if(rfbScreen->port>0) { - FD_ZERO(&(rfbScreen->allFds)); if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port, iface)) < 0) { rfbLogPerror("ListenOnTCPPort"); |