summaryrefslogtreecommitdiffstats
path: root/libvncserver
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2017-02-21 19:37:43 +0100
committerChristian Beier <dontmind@freeshell.org>2017-02-21 19:37:43 +0100
commit6cb0522ecbbf60872270ce8835fce2a9366534a2 (patch)
tree0df4bf0bd6ea0fcd275bd9ad9202e0075e617f26 /libvncserver
parent7edd53ec277a6d4942caf315b1aba741d2cbc414 (diff)
downloadlibtdevnc-6cb0522ecbbf60872270ce8835fce2a9366534a2.tar.gz
libtdevnc-6cb0522ecbbf60872270ce8835fce2a9366534a2.zip
rfbInitServer: only init Winsock once
Diffstat (limited to 'libvncserver')
-rw-r--r--libvncserver/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libvncserver/main.c b/libvncserver/main.c
index 27b5437..95c3da5 100644
--- a/libvncserver/main.c
+++ b/libvncserver/main.c
@@ -1061,7 +1061,15 @@ void rfbInitServer(rfbScreenInfoPtr screen)
{
#ifdef WIN32
WSADATA trash;
- WSAStartup(MAKEWORD(2,2),&trash);
+ static rfbBool WSAinitted=FALSE;
+ if(!WSAinitted) {
+ int i=WSAStartup(MAKEWORD(2,0),&trash);
+ if(i!=0) {
+ rfbErr("Couldn't init Windows Sockets\n");
+ return 0;
+ }
+ WSAinitted=TRUE;
+ }
#endif
rfbInitSockets(screen);
rfbHttpInitSockets(screen);