From cc3b0d9dc2358a1961cd5bbc1d14cf367b7df1ca Mon Sep 17 00:00:00 2001 From: Brian Bosak Date: Mon, 12 Aug 2013 17:27:36 -0500 Subject: [PATCH] Commit bugs are finally all fixed now :) --- console.c | 13 ------------- lhnet.c | 48 +++--------------------------------------------- lhnet.h | 4 ---- 3 files changed, 3 insertions(+), 62 deletions(-) diff --git a/console.c b/console.c index 6fd92ea0..983786d1 100644 --- a/console.c +++ b/console.c @@ -606,10 +606,8 @@ static void Con_MessageMode_f (void) chat_mode = 0; // "say" if(Cmd_Argc() > 1) { - dpsnprintf(chat_buffer, sizeof(chat_buffer), "%s ", Cmd_Args()); chat_bufferlen = strlen(chat_buffer); - } } @@ -2090,17 +2088,6 @@ qboolean GetMapList (const char *s, char *completedname, int completednamebuffer dpsnprintf(desc, sizeof(desc), "BSP2"); } else if (!memcmp(buf, "2PSB", 4)) - { - lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES); - lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4); - } - else if (!memcmp(buf, "BSP2", 4)) - { - lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES); - lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4); - dpsnprintf(desc, sizeof(desc), "BSP2"); - } - else if (!memcmp(buf, "2PSB", 4)) { lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES); lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4); diff --git a/lhnet.c b/lhnet.c index 28ce4fc9..fe2d6733 100644 --- a/lhnet.c +++ b/lhnet.c @@ -873,11 +873,10 @@ static int LHNETSOCKET_TryBind(lhnetsocket_t *lhnetsocket, lhnetaddress_t *addre { SOCKLEN_T namelen; int bindresult; - lhnetaddressnative_t *localaddress; if (!address) return 0; lhnetsocket->address = *address; - localaddress = (lhnetaddressnative_t *)&lhnetsocket->address; + lhnetaddressnative_t *localaddress = (lhnetaddressnative_t *)&lhnetsocket->address; #ifdef SUPPORTIPV6 if (address->addresstype == LHNETADDRESSTYPE_INET6) { @@ -901,10 +900,9 @@ static int LHNETSOCKET_TryConnect(lhnetsocket_t *lhnetsocket, lhnetaddress_t *ad { SOCKLEN_T namelen; int connectresult; - lhnetaddressnative_t *peeraddress; if (!address) return 0; - peeraddress = (lhnetaddressnative_t *)&lhnetsocket->address; + lhnetaddressnative_t *peeraddress = (lhnetaddressnative_t *)&lhnetsocket->address; #ifdef SUPPORTIPV6 if (address->addresstype == LHNETADDRESSTYPE_INET6) { @@ -927,11 +925,10 @@ static int LHNETSOCKET_TryConnect(lhnetsocket_t *lhnetsocket, lhnetaddress_t *ad lhnetsocket_t *LHNET_OpenSocket(lhnetaddress_t *address, lhnetaddress_t *peeraddress, int use_tcp, int use_blocking, int register_for_select) { lhnetsocket_t *lhnetsocket, *s; - int addresstype; if (!address && !peeraddress) return NULL; - addresstype = address ? address->addresstype : peeraddress->addresstype; + int addresstype = address ? address->addresstype : peeraddress->addresstype; if (peeraddress && addresstype != peeraddress->addresstype) { Con_Printf("Cannot connect different address types.\n"); @@ -1049,21 +1046,6 @@ lhnetsocket_t *LHNET_OpenSocket(lhnetaddress_t *address, lhnetaddress_t *peeradd #if defined(SOL_RFC1149) && defined(RFC1149_1149ONLY) // we got reports of massive lags when this protocol was chosen as transport // so better turn it off -<<<<<<< HEAD - { - int rfc1149only = 0; - int rfc1149enabled = 0; - if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_1149ONLY, &rfc1149only)) - Con_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_1149ONLY) returned error: %s\n", LHNETPRIVATE_StrError()); - if(setsockopt(lhnetsocket->inetsocket, SOL_RFC1149, RFC1149_ENABLED, &rfc1149enabled)) - Con_Printf("LHNET_OpenSocket_Connectionless: warning: setsockopt(RFC1149_ENABLED) returned error: %s\n", LHNETPRIVATE_StrError()); - } -#endif - -#ifdef SUPPORTIPV6 - if (address->addresstype == LHNETADDRESSTYPE_INET6) -======= ->>>>>>> origin/divVerent/lhnet_tcp { int rfc1149only = 0; int rfc1149enabled = 0; @@ -1075,29 +1057,6 @@ lhnetsocket_t *LHNET_OpenSocket(lhnetaddress_t *address, lhnetaddress_t *peeradd #endif if (LHNETSOCKET_TryBind(lhnetsocket, address) != -1) { -<<<<<<< HEAD - namelen = sizeof(localaddress->addr.in); - bindresult = bind(lhnetsocket->inetsocket, &localaddress->addr.sock, namelen); - if (bindresult != -1) - getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen); - } - if (bindresult != -1) - { - int i = 1; - // enable broadcast on this socket - setsockopt(lhnetsocket->inetsocket, SOL_SOCKET, SO_BROADCAST, (char *)&i, sizeof(i)); -#ifdef IP_TOS - { - // enable DSCP for ToS support - int tos = lhnet_default_dscp << 2; - setsockopt(lhnetsocket->inetsocket, IPPROTO_IP, IP_TOS, (char *) &tos, sizeof(tos)); - } -#endif - lhnetsocket->next = &lhnet_socketlist; - lhnetsocket->prev = lhnetsocket->next->prev; - lhnetsocket->next->prev = lhnetsocket; - lhnetsocket->prev->next = lhnetsocket; -======= if (LHNETSOCKET_TryConnect(lhnetsocket, peeraddress) != -1) { int i = 1; @@ -1114,7 +1073,6 @@ lhnetsocket_t *LHNET_OpenSocket(lhnetaddress_t *address, lhnetaddress_t *peeradd lhnetsocket->prev = lhnetsocket->next->prev; lhnetsocket->next->prev = lhnetsocket; lhnetsocket->prev->next = lhnetsocket; ->>>>>>> origin/divVerent/lhnet_tcp #ifdef WIN32 if (ioctlsocket(lhnetsocket->inetsocket, SIO_UDP_CONNRESET, &_false) == -1) Con_DPrintf("LHNET_OpenSocket_Connectionless: ioctlsocket SIO_UDP_CONNRESET returned error: %s\n", LHNETPRIVATE_StrError()); diff --git a/lhnet.h b/lhnet.h index 069188eb..817c0e65 100644 --- a/lhnet.h +++ b/lhnet.h @@ -40,10 +40,6 @@ lhnetsocket_t; void LHNET_Init(void); // must be called before any other threads got spawned void LHNET_Shutdown(void); -int LHNET_DefaultDSCP(int dscp); // < 0: query; >= 0: set (returns previous value) -void LHNET_SleepUntilPacket_Microseconds(int microseconds); -lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address); -void LHNET_CloseSocket(lhnetsocket_t *lhnetsocket); int LHNET_DefaultDSCP(int dscp); // < 0: query; >= 0: set (returns previous value); NOT thread-safe but usually does not matter (lhnet_default_dscp) void LHNET_SleepUntilPacket_Microseconds(int microseconds); // must only be used from the main thread lhnetsocket_t *LHNET_OpenSocket(lhnetaddress_t *address, lhnetaddress_t *peeraddress, int use_tcp, int use_blocking, int register_for_select); // thread-safe ONLY if register_for_select is false (socketlist) -- 2.39.2