From: havoc Date: Sun, 27 Aug 2006 09:23:07 +0000 (+0000) Subject: greatly improved chances of connecting to a proquake server on the first try, by... X-Git-Tag: xonotic-v0.1.0preview~3813 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=4e8af786c2089e92eb77d2626cb1e6077a71db1e;p=xonotic%2Fdarkplaces.git greatly improved chances of connecting to a proquake server on the first try, by sending an svc_nop immediately upon connect git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@6573 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/netconn.c b/netconn.c index 6ad1e7e3..62dba984 100755 --- a/netconn.c +++ b/netconn.c @@ -1085,6 +1085,18 @@ void NetConn_ConnectionEstablished(lhnetsocket_t *mysocket, lhnetaddress_t *peer cls.protocol = initialprotocol; if (cls.protocol == PROTOCOL_QUAKEWORLD) Cmd_ForwardStringToServer("new"); + if (cls.protocol == PROTOCOL_QUAKE) + { + // write a keepalive (svc_nop) as it seems to greatly improve the + // chances of connecting to a netquake server + sizebuf_t msg; + unsigned char buf[4]; + memset(&msg, 0, sizeof(msg)); + msg.data = buf; + msg.maxsize = sizeof(buf); + MSG_WriteChar(&msg, svc_nop); + NetConn_SendUnreliableMessage(cls.netcon, &msg, cls.protocol); + } } int NetConn_IsLocalGame(void) @@ -1441,9 +1453,9 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat length -= 4; LHNETADDRESS_SetPort(&clientportaddress, port); } - M_Update_Return_Reason("Accepted"); // update the server IP in the userinfo (QW servers expect this, and it is used by the reconnect command) InfoString_SetValue(cls.userinfo, sizeof(cls.userinfo), "*ip", addressstring2); + M_Update_Return_Reason("Accepted"); NetConn_ConnectionEstablished(mysocket, &clientportaddress, PROTOCOL_QUAKE); } break; @@ -1453,7 +1465,6 @@ static int NetConn_ClientParsePacket(lhnetsocket_t *mysocket, unsigned char *dat cls.connect_trying = false; M_Update_Return_Reason((char *)data); break; - // TODO: fix this code so that lan searches for quake servers will work case CCREP_SERVER_INFO: if (developer.integer >= 10) Con_Printf("Datagram_ParseConnectionless: received CCREP_SERVER_INFO from %s.\n", addressstring2);