diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-11-18 15:17:29 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-11-18 15:17:29 -0300 |
| commit | 8c2a8461db64e92ac09f202589009ee05c69626d (patch) | |
| tree | f9ce7d131e13aadd3c5fdcd8e7d7911c3395b1b3 /src/connections.cc | |
| parent | 093e1563df314c661bb1b73524309fd154001ce2 (diff) | |
| download | querymanager-8c2a8461db64e92ac09f202589009ee05c69626d.tar.gz querymanager-8c2a8461db64e92ac09f202589009ee05c69626d.zip | |
fix problem with connection input + allow login server to query worlds
There was a small problem with how we computed the size of the
packet "header". It was unlikely to manifest tho, because it's at
the beginning of a TCP message and TCP segments aren't that small,
unless the whole message is that small.
I'm also allowing login servers to query for world information
to allow a basic form of `STATUS` to be implemented.
Diffstat (limited to 'src/connections.cc')
| -rw-r--r-- | src/connections.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/connections.cc b/src/connections.cc index b851954..b148292 100644 --- a/src/connections.cc +++ b/src/connections.cc @@ -189,9 +189,9 @@ void CheckConnectionInput(TConnection *Connection, int Events){ int ReadSize = Connection->RWSize; if(ReadSize == 0){ if(Connection->RWPosition < 2){ - ReadSize = 2 - Connection->RWPosition; + ReadSize = 2; }else{ - ReadSize = 6 - Connection->RWPosition; + ReadSize = 6; } ASSERT(ReadSize > 0); } @@ -392,7 +392,8 @@ void CheckConnectionQueryRequest(TConnection *Connection){ SendQueryFailed(Connection); } }else if(Connection->ApplicationType == APPLICATION_TYPE_LOGIN){ - if(QueryType == QUERY_LOGIN_ACCOUNT){ + // TODO(fusion): Probably have a custom query for querying world status? + if(QueryType == QUERY_LOGIN_ACCOUNT || QueryType == QUERY_GET_WORLDS){ ProcessQuery(Connection); }else{ LOG_ERR("Invalid LOGIN query %d (%s) from %s", @@ -599,7 +600,7 @@ void ProcessConnections(void){ } for(int i = 0; i < g_Config.MaxConnections; i += 1){ - if(g_Connections[i].State == CONNECTION_FREE || g_Connections[i].Socket == -1){ + if(g_Connections[i].State == CONNECTION_FREE){ continue; } |
