mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
fixed the server to report the alternative port correctly
This commit is contained in:
parent
24b023a445
commit
8f39b81ab0
|
@ -43,6 +43,7 @@ MACRO_CONFIG_STR(masterserver, 128, "master.teewars.com")
|
|||
MACRO_CONFIG_STR(sv_name, 128, "unnamed server")
|
||||
MACRO_CONFIG_STR(sv_bindaddr, 128, "")
|
||||
MACRO_CONFIG_INT(sv_port, 8303, 0, 0)
|
||||
MACRO_CONFIG_INT(sv_external_port, 0, 0, 0)
|
||||
MACRO_CONFIG_INT(sv_sendheartbeats, 1, 0, 1)
|
||||
MACRO_CONFIG_STR(sv_map, 128, "dm1")
|
||||
MACRO_CONFIG_INT(sv_map_reload, 0, 0, 1)
|
||||
|
|
|
@ -435,12 +435,24 @@ static void server_send_map(int cid)
|
|||
|
||||
static void server_send_heartbeat()
|
||||
{
|
||||
static unsigned char data[sizeof(SERVERBROWSE_HEARTBEAT) + 2];
|
||||
unsigned short port = config.sv_port;
|
||||
NETPACKET packet;
|
||||
|
||||
mem_copy(data, SERVERBROWSE_HEARTBEAT, sizeof(SERVERBROWSE_HEARTBEAT));
|
||||
|
||||
packet.client_id = -1;
|
||||
packet.address = master_server;
|
||||
packet.flags = PACKETFLAG_CONNLESS;
|
||||
packet.data_size = sizeof(SERVERBROWSE_HEARTBEAT);
|
||||
packet.data = SERVERBROWSE_HEARTBEAT;
|
||||
packet.data_size = sizeof(SERVERBROWSE_HEARTBEAT) + 2;
|
||||
packet.data = &data;
|
||||
|
||||
/* supply the set port that the master can use if it has problems */
|
||||
if(config.sv_external_port)
|
||||
port = config.sv_external_port;
|
||||
data[sizeof(SERVERBROWSE_HEARTBEAT)] = port >> 8;
|
||||
data[sizeof(SERVERBROWSE_HEARTBEAT)+1] = port&0xff;
|
||||
|
||||
netserver_send(net, &packet);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue