]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Merge remote-tracking branch 'origin/divVerent/lhnet_tcp' into IDWMaster/lobby_and_ch...
authorBrian Bosak <webadm@elcnet.servehttp.com>
Mon, 12 Aug 2013 21:21:46 +0000 (16:21 -0500)
committerBrian Bosak <webadm@elcnet.servehttp.com>
Mon, 12 Aug 2013 21:21:46 +0000 (16:21 -0500)
Conflicts:
console.c
lhnet.c
lhnet.h

1  2 
console.c
lhnet.c
lhnet.h
makefile.inc

diff --cc console.c
index b82d9a48b42e5ab01ec4835a63b8e2cc832df9a4,983786d12a119611e3cfe76af3f748cedd3ff3a2..247bf7381993e220de9951aeeed2a9ef3caf88b6
+++ 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 e3bc6b712186f54dd511fd4165ddfc2f54fa3c88,fe2d6733e4571f07fd4f9a27fb05d621acf91f37..cb0c3f06c44f7831bb94265d1d870ddcdb7fe97a
+++ 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 e66e5a5d8f9ca8068d037a00ae943a51edf573e1,817c0e65bbd41ce143124ffdfd561ced003a456c..4dd25cce42d98c72637cb5e80ff95fdbc88ee2c8
+++ 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 7912786a6f8672e0745a4ed1ca4f6440af4a053c,80ab84b7735c114a653d155b0fdc34305e2b5a27..2fe5e9e7c5b8864fc073255536d5f1e65a2a1a45
@@@ -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