Merge pull request #4130 from GregorR/netplay-socket-legacy-may-as-well-be-called-no-sockets

More stripping out of NAT traversal for SOCKET_LEGACY
This commit is contained in:
Twinaphex 2016-12-02 19:37:46 +01:00 committed by GitHub
commit 673c0ab626
2 changed files with 12 additions and 9 deletions

View File

@ -42,6 +42,7 @@ static struct IGDdatas data;
void natt_init(void) void natt_init(void)
{ {
#ifndef HAVE_SOCKET_LEGACY
#if HAVE_MINIUPNPC #if HAVE_MINIUPNPC
struct UPNPDev * devlist; struct UPNPDev * devlist;
struct UPNPDev * dev; struct UPNPDev * dev;
@ -81,6 +82,7 @@ void natt_init(void)
freeUPNPDevlist(devlist); freeUPNPDevlist(devlist);
} }
#endif #endif
#endif
} }
bool natt_new(struct natt_status *status) bool natt_new(struct natt_status *status)
@ -96,6 +98,7 @@ void natt_free(struct natt_status *status)
bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t addrlen, enum socket_protocol proto) bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t addrlen, enum socket_protocol proto)
{ {
#ifndef HAVE_SOCKET_LEGACY
#if HAVE_MINIUPNPC #if HAVE_MINIUPNPC
char host[PATH_MAX_LENGTH], ext_host[PATH_MAX_LENGTH], char host[PATH_MAX_LENGTH], ext_host[PATH_MAX_LENGTH],
port_str[6], ext_port_str[6]; port_str[6], ext_port_str[6];
@ -160,6 +163,9 @@ bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t
return true; return true;
#else
return false;
#endif
#else #else
return false; return false;
#endif #endif
@ -167,6 +173,7 @@ bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t
bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_protocol proto) bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_protocol proto)
{ {
#ifndef HAVE_SOCKET_LEGACY
struct net_ifinfo list; struct net_ifinfo list;
bool ret = false; bool ret = false;
size_t i; size_t i;
@ -199,6 +206,10 @@ bool natt_open_port_any(struct natt_status *status, uint16_t port, enum socket_p
net_ifinfo_free(&list); net_ifinfo_free(&list);
return ret; return ret;
#else
return false;
#endif
} }
bool natt_read(struct natt_status *status) bool natt_read(struct natt_status *status)

View File

@ -1108,15 +1108,7 @@ static void announce_nat_traversal(netplay_t *netplay)
else return; else return;
#else #else
if (netplay->nat_traversal_state.have_inet4) return;
{
host[0] = '\0';
snprintf(port, 6, "%hu",
ntohs(netplay->nat_traversal_state.ext_inet4_addr.sin_port));
port[5] = '\0';
}
else return;
#endif #endif