From: Brian Bosak Date: Mon, 12 Aug 2013 21:21:46 +0000 (-0500) Subject: Merge remote-tracking branch 'origin/divVerent/lhnet_tcp' into IDWMaster/lobby_and_ch... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=75ef0c6d0e5856b55bf4ff13f73ea212700f8f96;p=xonotic%2Fdarkplaces.git Merge remote-tracking branch 'origin/divVerent/lhnet_tcp' into IDWMaster/lobby_and_chat_support Conflicts: console.c lhnet.c lhnet.h --- 75ef0c6d0e5856b55bf4ff13f73ea212700f8f96 diff --cc console.c index b82d9a48,983786d1..247bf738 --- a/console.c +++ b/console.c @@@ -2082,17 -2080,17 +2082,31 @@@ qboolean GetMapList (const char *s, cha lumpofs = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES); lumplen = BuffLittleLong(buf + 4 + 8 * LUMP_ENTITIES + 4); dpsnprintf(desc, sizeof(desc), "BSPHL"); ++<<<<<<< HEAD + } + 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); ++======= + } + 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); ++>>>>>>> origin/divVerent/lhnet_tcp dpsnprintf(desc, sizeof(desc), "BSP2RMQe"); } else diff --cc lhnet.c index e3bc6b71,fe2d6733..cb0c3f06 --- a/lhnet.c +++ b/lhnet.c @@@ -723,7 -725,7 +725,11 @@@ lhnetpacket_t static int lhnet_active; static lhnetsocket_t lhnet_socketlist; static lhnetpacket_t lhnet_packetlist; ++<<<<<<< HEAD +static int lhnet_default_dscp = 0; ++======= + static volatile int lhnet_default_dscp = 0; ++>>>>>>> origin/divVerent/lhnet_tcp #ifdef WIN32 static int lhnet_didWSAStartup = 0; static WSADATA lhnet_winsockdata; @@@ -962,56 -1046,48 +1050,87 @@@ lhnetsocket_t *LHNET_OpenSocket(lhnetad #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 { - namelen = sizeof(localaddress->addr.in6); - bindresult = bind(lhnetsocket->inetsocket, &localaddress->addr.sock, namelen); - if (bindresult != -1) - getsockname(lhnetsocket->inetsocket, &localaddress->addr.sock, &namelen); + 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()); } - else #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; + // 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; ++>>>>>>> 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()); + if (ioctlsocket(lhnetsocket->inetsocket, SIO_UDP_CONNRESET, &_false) == -1) + Con_DPrintf("LHNET_OpenSocket_Connectionless: ioctlsocket SIO_UDP_CONNRESET returned error: %s\n", LHNETPRIVATE_StrError()); #endif - return lhnetsocket; + return lhnetsocket; + } + else + { + Con_Printf("LHNET_OpenSocket_Connectionless: connect returned error: %s\n", LHNETPRIVATE_StrError()); + } } else + { Con_Printf("LHNET_OpenSocket_Connectionless: bind returned error: %s\n", LHNETPRIVATE_StrError()); + } } #ifdef IPV6_V6ONLY else diff --cc lhnet.h index e66e5a5d,817c0e65..4dd25cce --- a/lhnet.h +++ b/lhnet.h @@@ -38,12 -38,13 +38,20 @@@ typedef struct lhnetsocket_ } lhnetsocket_t; - void LHNET_Init(void); + void LHNET_Init(void); // must be called before any other threads got spawned void LHNET_Shutdown(void); ++<<<<<<< HEAD +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) + lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address); // NOT thread-safe! (socketlist) + void LHNET_CloseSocket(lhnetsocket_t *lhnetsocket); // thread-safe ONLY when the socket was created with register_for_select being false (socketlist) ++>>>>>>> origin/divVerent/lhnet_tcp lhnetaddress_t *LHNET_AddressFromSocket(lhnetsocket_t *sock); int LHNET_Read(lhnetsocket_t *lhnetsocket, void *content, int maxcontentlength, lhnetaddress_t *address); int LHNET_Write(lhnetsocket_t *lhnetsocket, const void *content, int contentlength, const lhnetaddress_t *address); diff --cc makefile.inc index 7912786a,80ab84b7..2fe5e9e7 --- a/makefile.inc +++ b/makefile.inc @@@ -157,13 -157,12 +157,17 @@@ OBJ_COMMON= view.o \ wad.o \ world.o \ - zone.o + zone.o \ + lobby_gameroom.c + +OBJ_MENU= \ + menu.o \ + mvm_cmds.o + OBJ_MENU= \ + menu.o \ + mvm_cmds.o + # note that builddate.c is very intentionally not compiled to a .o before # being linked, because it should be recompiled every time an executable is # built to give the executable a proper date string