mirror of
https://github.com/EQEmu/Server.git
synced 2026-09-04 18:46:37 +00:00
Streams work on all of the servers now
This commit is contained in:
+4
-9
@@ -23,16 +23,11 @@ INSTALL(TARGETS ucs RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
ADD_DEFINITIONS(-DUCS)
|
||||
|
||||
TARGET_LINK_LIBRARIES(ucs common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(ucs common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt)
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(ucs PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(ucs "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(ucs "WS2_32")
|
||||
ENDIF(MINGW)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(ucs "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(ucs "${CMAKE_DL_LIBS}")
|
||||
|
||||
+11
-26
@@ -25,7 +25,6 @@
|
||||
#include "database.h"
|
||||
#include "chatchannel.h"
|
||||
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/emu_tcp_connection.h"
|
||||
#include "../common/emu_tcp_server.h"
|
||||
#include <list>
|
||||
@@ -468,21 +467,22 @@ static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
|
||||
|
||||
}
|
||||
Clientlist::Clientlist(int ChatPort) {
|
||||
|
||||
chatsf = new EQStreamFactory(ChatStream, ChatPort, 45000);
|
||||
EQ::Net::EQStreamManagerOptions chat_opts(ChatPort, false, false);
|
||||
chat_opts.opcode_size = 1;
|
||||
chatsf = new EQ::Net::EQStreamManager(chat_opts);
|
||||
|
||||
ChatOpMgr = new RegularOpcodeManager;
|
||||
|
||||
if(!ChatOpMgr->LoadOpcodes("mail_opcodes.conf"))
|
||||
exit(1);
|
||||
|
||||
if (chatsf->Open())
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server,"Client (UDP) Chat listener started on port %i.", ChatPort);
|
||||
else {
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server,"Failed to start client (UDP) listener (port %-4i)", ChatPort);
|
||||
chatsf->OnNewConnection([this](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
Log.OutF(Logs::General, Logs::Login_Server, "New Client UDP connection from {0}:{1}", stream->RemoteEndpoint(), stream->GetRemotePort());
|
||||
stream->SetOpcodeManager(&ChatOpMgr);
|
||||
|
||||
exit(1);
|
||||
}
|
||||
auto c = new Client(stream);
|
||||
ClientChatConnections.push_back(c);
|
||||
});
|
||||
}
|
||||
|
||||
Client::Client(std::shared_ptr<EQStreamInterface> eqs) {
|
||||
@@ -574,21 +574,6 @@ void Clientlist::CheckForStaleConnections(Client *c) {
|
||||
|
||||
void Clientlist::Process()
|
||||
{
|
||||
std::shared_ptr<EQStreamInterface> eqs;
|
||||
|
||||
while ((eqs = chatsf->Pop())) {
|
||||
struct in_addr in;
|
||||
in.s_addr = eqs->GetRemoteIP();
|
||||
|
||||
Log.Out(Logs::Detail, Logs::UCS_Server, "New Client UDP connection from %s:%d", inet_ntoa(in),
|
||||
ntohs(eqs->GetRemotePort()));
|
||||
|
||||
eqs->SetOpcodeManager(&ChatOpMgr);
|
||||
|
||||
auto c = new Client(eqs);
|
||||
ClientChatConnections.push_back(c);
|
||||
}
|
||||
|
||||
auto it = ClientChatConnections.begin();
|
||||
while (it != ClientChatConnections.end()) {
|
||||
(*it)->AccountUpdate();
|
||||
@@ -614,7 +599,7 @@ void Clientlist::Process()
|
||||
|
||||
switch (opcode) {
|
||||
case OP_MailLogin: {
|
||||
char *PacketBuffer = (char *)app->pBuffer;
|
||||
char *PacketBuffer = (char *)app->pBuffer + 1;
|
||||
char MailBox[64];
|
||||
char Key[64];
|
||||
char ConnectionTypeIndicator;
|
||||
@@ -668,7 +653,7 @@ void Clientlist::Process()
|
||||
}
|
||||
|
||||
case OP_Mail: {
|
||||
std::string CommandString = (const char *)app->pBuffer;
|
||||
std::string CommandString = (const char *)app->pBuffer + 1;
|
||||
ProcessOPMailCommand((*it), CommandString);
|
||||
break;
|
||||
}
|
||||
|
||||
+2
-3
@@ -21,8 +21,7 @@
|
||||
#define CHATSERVER_CLIENTLIST_H
|
||||
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_type.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/net/eqstream.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "chatchannel.h"
|
||||
#include <list>
|
||||
@@ -185,7 +184,7 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
EQStreamFactory *chatsf;
|
||||
EQ::Net::EQStreamManager *chatsf;
|
||||
|
||||
std::list<Client*> ClientChatConnections;
|
||||
|
||||
|
||||
+3
-4
@@ -21,11 +21,11 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "clientlist.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/platform.h"
|
||||
#include "../common/crash.h"
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "database.h"
|
||||
#include "ucsconfig.h"
|
||||
#include "chatchannel.h"
|
||||
@@ -36,7 +36,6 @@
|
||||
ChatChannelList *ChannelList;
|
||||
Clientlist *g_Clientlist;
|
||||
EQEmuLogSys Log;
|
||||
TimeoutManager timeout_manager;
|
||||
Database database;
|
||||
WorldServer *worldserver = nullptr;
|
||||
|
||||
@@ -158,9 +157,9 @@ int main() {
|
||||
}
|
||||
worldserver->Process();
|
||||
|
||||
timeout_manager.CheckTimeouts();
|
||||
EQ::EventLoop::Get().Process();
|
||||
|
||||
Sleep(100);
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
ChannelList->RemoveAllChannels();
|
||||
|
||||
Reference in New Issue
Block a user