mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 12:18:27 +00:00
World <-> Login connection reworked
This commit is contained in:
+26
-12
@@ -86,6 +86,9 @@
|
||||
#include "ucs.h"
|
||||
#include "queryserv.h"
|
||||
|
||||
#include "../common/net/tcp_server.h"
|
||||
#include "../common/net/servertalk_server.h"
|
||||
|
||||
EmuTCPServer tcps;
|
||||
ClientList client_list;
|
||||
GroupLFPList LFPGroupList;
|
||||
@@ -412,6 +415,28 @@ int main(int argc, char** argv) {
|
||||
Log.OutF(Logs::Detail, Logs::World_Server, "New connection from IP {0}:{1}", stream->RemoteEndpoint(), ntohs(stream->GetRemotePort()));
|
||||
});
|
||||
|
||||
EQ::Net::ServertalkServer server;
|
||||
EQ::Net::ServertalkServerOptions stopts;
|
||||
stopts.port = 5999;
|
||||
stopts.credentials = "User:Root;Password:1234567890";
|
||||
stopts.encrypted = true;
|
||||
server.Listen(stopts);
|
||||
|
||||
server.OnConnectionIdentified("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> conn) {
|
||||
Log.Out(Logs::General, Logs::Debug, "New QueryServ Connection....");
|
||||
EQ::Net::WritablePacket out;
|
||||
out.PutCString(0, "Hello");
|
||||
conn->Send(1, out);
|
||||
|
||||
conn->OnMessage(2, [&](uint16_t opcode, EQ::Net::Packet &p) {
|
||||
Log.OutF(Logs::General, Logs::Debug, "Server got message of type {0}\n{1}", opcode, p.ToString());
|
||||
});
|
||||
});
|
||||
|
||||
server.OnConnectionRemoved("QueryServ", [](std::shared_ptr<EQ::Net::ServertalkServerConnection> conn) {
|
||||
Log.Out(Logs::General, Logs::Debug, "Lost QueryServ connection.");
|
||||
});
|
||||
|
||||
while(RunLoops) {
|
||||
Timer::SetCurrentTime();
|
||||
eqs = nullptr;
|
||||
@@ -487,7 +512,6 @@ int main(int argc, char** argv) {
|
||||
Log.Out(Logs::Detail, Logs::World_Server, "EQTime successfully saved.");
|
||||
}
|
||||
|
||||
loginserverlist.Process();
|
||||
console_list.Process();
|
||||
zoneserver_list.Process();
|
||||
launcher_list.Process();
|
||||
@@ -498,17 +522,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
if (InterserverTimer.Check()) {
|
||||
InterserverTimer.Start();
|
||||
database.ping();
|
||||
|
||||
if (loginserverlist.AllConnected() == false) {
|
||||
#ifdef _WINDOWS
|
||||
_beginthread(AutoInitLoginServer, 0, nullptr);
|
||||
#else
|
||||
pthread_t thread;
|
||||
pthread_create(&thread, nullptr, &AutoInitLoginServer, nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
database.ping();
|
||||
}
|
||||
|
||||
EQ::EventLoop::Get().Process();
|
||||
|
||||
Reference in New Issue
Block a user