mirror of
https://github.com/solemnwarning/directplay-lite
synced 2024-12-30 16:45:37 +01:00
IDirectPlay8Peer: Implement DPLITE_CONNECT_IP environment variable.
If set, this will override the host IP address to connect to in IDirectPlay8Peer::Connect()
This commit is contained in:
parent
8d46ae9e9b
commit
7cc4e85f6d
@ -481,6 +481,25 @@ HRESULT DirectPlay8Peer::Connect(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, I
|
|||||||
return DPNERR_INVALIDHOSTADDRESS;
|
return DPNERR_INVALIDHOSTADDRESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *override_ip = getenv("DPLITE_CONNECT_IP");
|
||||||
|
if(override_ip != NULL)
|
||||||
|
{
|
||||||
|
struct in_addr hostname_addr;
|
||||||
|
if(inet_pton(AF_INET, override_ip, &hostname_addr) == 1)
|
||||||
|
{
|
||||||
|
log_printf(
|
||||||
|
"DPLITE_CONNECT_IP environment variable is set, connecting to '%s' instead",
|
||||||
|
override_ip);
|
||||||
|
r_ipaddr = hostname_addr.s_addr;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
log_printf(
|
||||||
|
"DPLITE_CONNECT_IP environment variable contains invalid IP address: %s",
|
||||||
|
override_ip);
|
||||||
|
return DPNERR_INVALIDHOSTADDRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(l_port == 0)
|
if(l_port == 0)
|
||||||
{
|
{
|
||||||
/* Start at a random point in the ephemeral port range and try each one, wrapping
|
/* Start at a random point in the ephemeral port range and try each one, wrapping
|
||||||
|
Loading…
x
Reference in New Issue
Block a user