]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - lhnet.c
inlined Host_EndGame in CL_ParseServerMessage's svc_disconnect case and greatly reduc...
[xonotic/darkplaces.git] / lhnet.c
diff --git a/lhnet.c b/lhnet.c
index 58033bac8fe18646028a5621af32c318a558a675..3af27a30402618e548e00b54f18b18806b022b9a 100644 (file)
--- a/lhnet.c
+++ b/lhnet.c
@@ -457,8 +457,10 @@ lhnetsocket_t *LHNET_OpenSocket_Connectionless(lhnetaddress_t *address)
                                        if (ioctl(lhnetsocket->inetsocket, FIONBIO, &_true) != -1)
 #endif
                                        {
-                                               if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4)) != -1)
+                                               size_t namelen = address->addresstype == LHNETADDRESSTYPE_INET6 ? sizeof(lhnetsocket->address.addressdata.inet6) : sizeof(lhnetsocket->address.addressdata.inet4);
+                                               if (bind(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, namelen) != -1)
                                                {
+                                                       getsockname(lhnetsocket->inetsocket, (void *)&lhnetsocket->address.addressdata, &namelen);
                                                        lhnetsocket->next = &lhnet_socketlist;
                                                        lhnetsocket->prev = lhnetsocket->next->prev;
                                                        lhnetsocket->next->prev = lhnetsocket;