Skip to content

Commit

Permalink
fix mastername func in authservers.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Apr 10, 2021
1 parent b4c7340 commit f65eb9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 10 additions & 8 deletions patches/authservers.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Index: src/engine/server.cpp
===================================================================
--- src/engine/server.cpp (revision 6491)
+++ src/engine/server.cpp (working copy)
@@ -338,172 +338,43 @@
@@ -338,172 +338,45 @@
if(c) process(packet, c->num, chan);
}

Expand Down Expand Up @@ -119,10 +119,12 @@ Index: src/engine/server.cpp
- if(masterinpos >= masterin.length()) return;
+authserver *masterserver;
+SVARF(mastername, server::defaultmaster(), {
+ if(!masterserver) return;
+ masterserver->disconnect();
+ copystring(masterserver->hostname, mastername);
+});
+VARF(masterport, 1, server::masterport(), 0xFFFF, {
+ if(!masterserver) return;
+ masterserver->disconnect();
+ masterserver->port = masterport;
+});
Expand Down Expand Up @@ -201,7 +203,7 @@ Index: src/engine/server.cpp
static ENetAddress pongaddr;

void sendserverinforeply(ucharbuf &p)
@@ -523,12 +394,14 @@
@@ -523,12 +396,14 @@
ENET_SOCKETSET_EMPTY(writeset);
ENetSocket maxsock = pongsock;
ENET_SOCKETSET_ADD(readset, pongsock);
Expand All @@ -220,7 +222,7 @@ Index: src/engine/server.cpp
if(lansock != ENET_SOCKET_NULL)
{
maxsock = max(maxsock, lansock);
@@ -552,28 +425,30 @@
@@ -552,28 +427,30 @@
server::serverinforeply(req, p);
}

Expand Down Expand Up @@ -261,7 +263,7 @@ Index: src/engine/server.cpp
}

VAR(serveruprate, 0, 0, INT_MAX);
@@ -584,11 +459,13 @@
@@ -584,11 +461,13 @@
int curtime = 0, lastmillis = 0, elapsedtime = 0, totalmillis = 0;
#endif

Expand All @@ -278,7 +280,7 @@ Index: src/engine/server.cpp
}

uint totalsecs = 0;
@@ -630,10 +507,11 @@
@@ -630,10 +509,11 @@
}
server::serverupdate();

Expand All @@ -292,7 +294,7 @@ Index: src/engine/server.cpp
updatemasterserver();

if(totalmillis-laststatus>60*1000) // display bandwidth stats, useful for server ops
@@ -1033,6 +911,8 @@
@@ -1033,6 +913,8 @@
return false;
}

Expand All @@ -301,15 +303,15 @@ Index: src/engine/server.cpp
bool setuplistenserver(bool dedicated)
{
ENetAddress address = { ENET_HOST_ANY, enet_uint16(serverport <= 0 ? server::serverport() : serverport) };
@@ -1062,6 +942,7 @@
@@ -1062,6 +944,7 @@
}
if(lansock == ENET_SOCKET_NULL) conoutf(CON_WARN, "WARNING: could not create LAN server info socket");
else enet_socket_set_option(lansock, ENET_SOCKOPT_NONBLOCK, 1);
+ if(!masterserver) masterserver = addauthserver("", mastername, &masterport, "m");
return true;
}

@@ -1119,6 +1001,7 @@
@@ -1119,6 +1003,7 @@
COMMAND(stoplistenserver, "");
#endif

Expand Down
2 changes: 2 additions & 0 deletions src/engine/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,10 +380,12 @@ bool requestauthserverf(const char *keydomain, const char *fmt, ...)

authserver *masterserver;
SVARF(mastername, server::defaultmaster(), {
if(!masterserver) return;
masterserver->disconnect();
copystring(masterserver->hostname, mastername);
});
VARF(masterport, 1, server::masterport(), 0xFFFF, {
if(!masterserver) return;
masterserver->disconnect();
masterserver->port = masterport;
});
Expand Down

0 comments on commit f65eb9a

Please sign in to comment.