]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - netconn.c
VM_sprintf: support color codes in %s
[xonotic/darkplaces.git] / netconn.c
index 2e1e9adb47dab61c2d827d9afb8f9ca8776e43a9..f01c3e05264a13b0016737ae1abcad01e3dec9d0 100755 (executable)
--- a/netconn.c
+++ b/netconn.c
@@ -923,7 +923,9 @@ void NetConn_OpenClientPorts(void)
        int port;
        NetConn_CloseClientPorts();
 
+       SV_LockThreadMutex(); // FIXME recursive?
        Crypto_LoadKeys(); // client sockets
+       SV_UnlockThreadMutex();
 
        port = bound(0, cl_netport.integer, 65535);
        if (cl_netport.integer != port)
@@ -991,7 +993,9 @@ void NetConn_OpenServerPorts(int opennetports)
        int port;
        NetConn_CloseServerPorts();
 
+       SV_LockThreadMutex(); // FIXME recursive?
        Crypto_LoadKeys(); // server sockets
+       SV_UnlockThreadMutex();
 
        NetConn_UpdateSockets();
        port = bound(0, sv_netport.integer, 65535);
@@ -1681,7 +1685,7 @@ static void NetConn_ClientParsePacket_ServerList_ParseDPList(lhnetaddress_t *sen
 static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *data, int length, lhnetaddress_t *peeraddress)
 {
        qboolean fromserver;
-       int ret, c, control;
+       int ret, c;
        const char *s;
        char *string, addressstring2[128], ipstring[32];
        char stringbuf[16384];
@@ -2060,7 +2064,7 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat
                return ret;
        }
        // netquake control packets, supported for compatibility only
-       if (length >= 5 && (control = BuffBigLong(data)) && (control & (~NETFLAG_LENGTH_MASK)) == (int)NETFLAG_CTL && (control & NETFLAG_LENGTH_MASK) == length && !ENCRYPTION_REQUIRED)
+       if (length >= 5 && BuffBigLong(data) == ((int)NETFLAG_CTL | length) && !ENCRYPTION_REQUIRED)
        {
                int n;
                serverlist_info_t *info;