mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
Streams work on all of the servers now
This commit is contained in:
parent
a76149c8e3
commit
7a3147a3b3
@ -26,8 +26,6 @@ SET(common_sources
|
||||
eqemu_logsys.cpp
|
||||
eq_limits.cpp
|
||||
eq_packet.cpp
|
||||
eq_stream.cpp
|
||||
eq_stream_factory.cpp
|
||||
eq_stream_ident.cpp
|
||||
eq_stream_proxy.cpp
|
||||
eqtime.cpp
|
||||
@ -69,7 +67,6 @@ SET(common_sources
|
||||
tcp_connection.cpp
|
||||
tcp_server.cpp
|
||||
textures.cpp
|
||||
timeoutmgr.cpp
|
||||
timer.cpp
|
||||
unix.cpp
|
||||
worldconn.cpp
|
||||
@ -142,13 +139,10 @@ SET(common_headers
|
||||
eqemu_logsys.h
|
||||
eq_limits.h
|
||||
eq_packet.h
|
||||
eq_stream.h
|
||||
eq_stream_factory.h
|
||||
eq_stream_ident.h
|
||||
eq_stream_intf.h
|
||||
eq_stream_locator.h
|
||||
eq_stream_proxy.h
|
||||
eq_stream_type.h
|
||||
eqtime.h
|
||||
errmsg.h
|
||||
extprofile.h
|
||||
@ -205,7 +199,6 @@ SET(common_headers
|
||||
tcp_connection.h
|
||||
tcp_server.h
|
||||
textures.h
|
||||
timeoutmgr.h
|
||||
timer.h
|
||||
types.h
|
||||
unix.h
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eq_stream_ident.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
|
||||
#include "misc.h"
|
||||
|
||||
EQStreamIdentifier::~EQStreamIdentifier() {
|
||||
while(!m_identified.empty()) {
|
||||
@ -98,14 +98,14 @@ void EQStreamIdentifier::Process() {
|
||||
Patch *p = *curp;
|
||||
|
||||
//ask the stream to see if it matches the supplied signature
|
||||
EQStream::MatchState res = r.stream->CheckSignature(&p->signature);
|
||||
EQStreamInterface::MatchState res = r.stream->CheckSignature(&p->signature);
|
||||
switch(res) {
|
||||
case EQStream::MatchNotReady:
|
||||
case EQStreamInterface::MatchNotReady:
|
||||
//the stream has not received enough packets to compare with this signature
|
||||
// Log.LogDebugType(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, but stream is not ready for it.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
all_ready = false;
|
||||
break;
|
||||
case EQStream::MatchSuccessful: {
|
||||
case EQStreamInterface::MatchSuccessful: {
|
||||
//yay, a match.
|
||||
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENTIFY] Identified stream %s:%d with signature %s", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
@ -120,7 +120,7 @@ void EQStreamIdentifier::Process() {
|
||||
found_one = true;
|
||||
break;
|
||||
}
|
||||
case EQStream::MatchFailed:
|
||||
case EQStreamInterface::MatchFailed:
|
||||
//do nothing...
|
||||
Log.Out(Logs::General, Logs::Netcode, "[IDENT_TRACE] %s:%d: Tried patch %s, and it did not match.", long2ip(r.stream->GetRemoteIP()).c_str(), ntohs(r.stream->GetRemotePort()), p->name.c_str());
|
||||
break;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef EQSTREAMIDENT_H_
|
||||
#define EQSTREAMIDENT_H_
|
||||
|
||||
#include "eq_stream.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "timer.h"
|
||||
#include <vector>
|
||||
#include <queue>
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
#include <string>
|
||||
#include "emu_versions.h"
|
||||
#include "eq_packet.h"
|
||||
|
||||
typedef enum {
|
||||
ESTABLISHED,
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
|
||||
#include "global_define.h"
|
||||
#include "eq_stream_proxy.h"
|
||||
#include "eq_stream.h"
|
||||
#include "struct_strategy.h"
|
||||
|
||||
|
||||
|
||||
@ -4,7 +4,6 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "eq_stream.h"
|
||||
#include <memory>
|
||||
|
||||
class StructStrategy;
|
||||
|
||||
@ -46,7 +46,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
||||
uv_timer_start(&m_resend_timer, [](uv_timer_t *handle) {
|
||||
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data;
|
||||
c->ProcessResend();
|
||||
}, 10, 10);
|
||||
}, 5, 5);
|
||||
|
||||
uv_udp_init(loop, &m_socket);
|
||||
m_socket.data = this;
|
||||
@ -174,6 +174,10 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
|
||||
{
|
||||
if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size < DaybreakHeader::size()) {
|
||||
Log.OutF(Logs::Detail, Logs::Netcode, "Packet of size {0} which is less than {1}", size, DaybreakHeader::size());
|
||||
return;
|
||||
@ -200,7 +204,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
|
||||
connection->ProcessPacket(p);
|
||||
}
|
||||
else if(data[1] != OP_OutOfSession) {
|
||||
SendSessionLost(endpoint, port);
|
||||
SendDisconnect(endpoint, port);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,11 +224,12 @@ std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::SendSessionLost(const std::string &addr, int port)
|
||||
void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr, int port)
|
||||
{
|
||||
DaybreakHeader header;
|
||||
DaybreakDisconnect header;
|
||||
header.zero = 0;
|
||||
header.opcode = OP_OutOfSession;
|
||||
header.opcode = OP_SessionDisconnect;
|
||||
header.connect_code = 0;
|
||||
|
||||
WritablePacket out;
|
||||
out.PutSerialize(0, header);
|
||||
@ -336,12 +341,8 @@ void EQ::Net::DaybreakConnection::ResetStats()
|
||||
|
||||
void EQ::Net::DaybreakConnection::Process()
|
||||
{
|
||||
m_resend_delay = (size_t)(m_rolling_ping * 1.33);
|
||||
|
||||
if (m_resend_delay < 15) {
|
||||
m_resend_delay = 15;
|
||||
}
|
||||
|
||||
try {
|
||||
m_resend_delay = (size_t)(m_stats.last_stat_ping * m_owner->m_options.resend_delay_factor) + m_owner->m_options.resend_delay_ms;
|
||||
if (m_resend_delay > 1000) {
|
||||
m_resend_delay = 1000;
|
||||
}
|
||||
@ -359,6 +360,10 @@ void EQ::Net::DaybreakConnection::Process()
|
||||
SendStatSync();
|
||||
m_last_stats = now;
|
||||
}
|
||||
}
|
||||
catch (std::exception ex) {
|
||||
Log.OutF(Logs::Detail, Logs::Netcode, "Error processing connection: {0}", ex.what());
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
||||
@ -954,12 +959,21 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
auto s = &m_streams[stream];
|
||||
for (auto &entry : s->sent_packets) {
|
||||
auto time_since_last_send = std::chrono::duration_cast<std::chrono::milliseconds>(now - entry.second.last_sent);
|
||||
if(entry.second.times_resent == 0) {
|
||||
if ((size_t)time_since_last_send.count() > m_resend_delay) {
|
||||
InternalBufferedSend(entry.second.packet);
|
||||
entry.second.last_sent = now;
|
||||
entry.second.times_resent++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ((size_t)time_since_last_send.count() > std::min(m_resend_delay / (entry.second.times_resent + 1), 5ULL)) {
|
||||
InternalBufferedSend(entry.second.packet);
|
||||
entry.second.last_sent = now;
|
||||
entry.second.times_resent++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
||||
@ -1042,6 +1056,7 @@ void EQ::Net::DaybreakConnection::SendStatSync()
|
||||
request.packets_sent = m_stats.sent_packets + 1;
|
||||
request.packets_recv = m_stats.recv_packets;
|
||||
m_last_session_stats = Clock::now();
|
||||
//InternalSend()
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
||||
@ -1130,9 +1145,14 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
|
||||
send_buffers[0].base = (char*)out.Data();
|
||||
send_buffers[0].len = out.Length();
|
||||
|
||||
uv_udp_send(send_req, &m_owner->m_socket, send_buffers, 1, (sockaddr*)&send_addr, send_func);
|
||||
m_stats.sent_bytes += out.Length();
|
||||
m_stats.sent_packets++;
|
||||
if (m_owner->m_options.simulated_out_packet_loss && m_owner->m_options.simulated_out_packet_loss >= m_owner->m_rand.Int(0, 100)) {
|
||||
delete send_req;
|
||||
return;
|
||||
}
|
||||
|
||||
uv_udp_send(send_req, &m_owner->m_socket, send_buffers, 1, (sockaddr*)&send_addr, send_func);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1144,9 +1164,15 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p)
|
||||
send_buffers[0].base = (char*)p.Data();
|
||||
send_buffers[0].len = p.Length();
|
||||
|
||||
uv_udp_send(send_req, &m_owner->m_socket, send_buffers, 1, (sockaddr*)&send_addr, send_func);
|
||||
m_stats.sent_bytes += p.Length();
|
||||
m_stats.sent_packets++;
|
||||
|
||||
if (m_owner->m_options.simulated_out_packet_loss && m_owner->m_options.simulated_out_packet_loss >= m_owner->m_rand.Int(0, 100)) {
|
||||
delete send_req;
|
||||
return;
|
||||
}
|
||||
|
||||
uv_udp_send(send_req, &m_owner->m_socket, send_buffers, 1, (sockaddr*)&send_addr, send_func);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
|
||||
|
||||
@ -217,10 +217,11 @@ namespace EQ
|
||||
DaybreakConnectionManagerOptions() {
|
||||
max_connection_count = 0;
|
||||
keepalive_delay_ms = 0;
|
||||
resend_delay_ms = 1000;
|
||||
resend_delay_ms = 10;
|
||||
resend_delay_factor = 1.25;
|
||||
stats_delay_ms = 0;
|
||||
connect_delay_ms = 1000;
|
||||
stale_connection_ms = 60000;
|
||||
stale_connection_ms = 135000;
|
||||
crc_length = 2;
|
||||
max_packet_size = 512;
|
||||
encode_passes[0] = DaybreakEncodeType::EncodeNone;
|
||||
@ -228,11 +229,14 @@ namespace EQ
|
||||
port = 0;
|
||||
hold_size = 384;
|
||||
hold_length_ms = 50;
|
||||
simulated_in_packet_loss = 0;
|
||||
simulated_out_packet_loss = 0;
|
||||
}
|
||||
|
||||
size_t max_packet_size;
|
||||
size_t max_connection_count;
|
||||
size_t keepalive_delay_ms;
|
||||
double resend_delay_factor;
|
||||
size_t resend_delay_ms;
|
||||
size_t stats_delay_ms;
|
||||
size_t connect_delay_ms;
|
||||
@ -240,6 +244,8 @@ namespace EQ
|
||||
size_t crc_length;
|
||||
size_t hold_size;
|
||||
size_t hold_length_ms;
|
||||
size_t simulated_in_packet_loss;
|
||||
size_t simulated_out_packet_loss;
|
||||
DaybreakEncodeType encode_passes[2];
|
||||
int port;
|
||||
};
|
||||
@ -274,7 +280,7 @@ namespace EQ
|
||||
|
||||
void ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size);
|
||||
std::shared_ptr<DaybreakConnection> FindConnectionByEndpoint(std::string addr, int port);
|
||||
void SendSessionLost(const std::string &addr, int port);
|
||||
void SendDisconnect(const std::string &addr, int port);
|
||||
|
||||
friend class DaybreakConnection;
|
||||
};
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#include "eq_stream.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "packet_dump_file.h"
|
||||
|
||||
void FileDumpPacketAscii(const char* filename, const uchar* buf, uint32 size, uint32 cols, uint32 skip) {
|
||||
|
||||
@ -3,7 +3,8 @@
|
||||
#include "eqemu_logsys.h"
|
||||
#include "struct_strategy.h"
|
||||
|
||||
#include "eq_stream.h"
|
||||
#include "eq_stream_intf.h"
|
||||
#include "opcodemgr.h"
|
||||
#include <map>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@ -41,16 +41,12 @@ ADD_EXECUTABLE(loginserver ${eqlogin_sources} ${eqlogin_headers})
|
||||
|
||||
INSTALL(TARGETS loginserver RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(loginserver common debug ${MySQL_LIBRARY_DEBUG} optimized ${MySQL_LIBRARY_RELEASE} ${ZLIB_LIBRARY} libuv fmt)
|
||||
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(loginserver PROPERTIES LINK_FLAGS_RELEASE "/OPT:REF /OPT:ICF")
|
||||
TARGET_LINK_LIBRARIES(loginserver "Ws2_32.lib")
|
||||
ENDIF(MSVC)
|
||||
IF(WIN32)
|
||||
TARGET_LINK_LIBRARIES(loginserver "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||
ENDIF(WIN32)
|
||||
|
||||
IF(MINGW)
|
||||
TARGET_LINK_LIBRARIES(loginserver "WS2_32")
|
||||
ENDIF(MINGW)
|
||||
|
||||
IF(UNIX)
|
||||
TARGET_LINK_LIBRARIES(loginserver "${CMAKE_DL_LIBS}")
|
||||
|
||||
@ -20,13 +20,13 @@
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_type.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/random.h"
|
||||
#ifndef WIN32
|
||||
#include "eq_crypto_api.h"
|
||||
#endif
|
||||
#include <string>
|
||||
|
||||
#include <memory>
|
||||
#include "../common/eq_stream_intf.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
@ -27,7 +27,8 @@ extern EQEmuLogSys Log;
|
||||
ClientManager::ClientManager()
|
||||
{
|
||||
int titanium_port = atoi(server.config->GetVariable("Titanium", "port").c_str());
|
||||
titanium_stream = new EQStreamFactory(LoginStream, titanium_port);
|
||||
EQ::Net::EQStreamManagerOptions titanium_opts(titanium_port, false, false);
|
||||
titanium_stream = new EQ::Net::EQStreamManager(titanium_opts);
|
||||
titanium_ops = new RegularOpcodeManager;
|
||||
if(!titanium_ops->LoadOpcodes(server.config->GetVariable("Titanium", "opcodes").c_str()))
|
||||
{
|
||||
@ -36,18 +37,16 @@ ClientManager::ClientManager()
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(titanium_stream->Open())
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on Titanium stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open Titanium stream.");
|
||||
run_server = false;
|
||||
}
|
||||
titanium_stream->OnNewConnection([this](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
Log.OutF(Logs::General, Logs::Login_Server, "New Titanium client connection from {0}:{1}", stream->RemoteEndpoint(), stream->GetRemotePort());
|
||||
stream->SetOpcodeManager(&titanium_ops);
|
||||
Client *c = new Client(stream, cv_titanium);
|
||||
clients.push_back(c);
|
||||
});
|
||||
|
||||
int sod_port = atoi(server.config->GetVariable("SoD", "port").c_str());
|
||||
sod_stream = new EQStreamFactory(LoginStream, sod_port);
|
||||
EQ::Net::EQStreamManagerOptions sod_opts(sod_port, false, false);
|
||||
sod_stream = new EQ::Net::EQStreamManager(sod_opts);
|
||||
sod_ops = new RegularOpcodeManager;
|
||||
if(!sod_ops->LoadOpcodes(server.config->GetVariable("SoD", "opcodes").c_str()))
|
||||
{
|
||||
@ -56,22 +55,18 @@ ClientManager::ClientManager()
|
||||
run_server = false;
|
||||
}
|
||||
|
||||
if(sod_stream->Open())
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Login_Server, "ClientManager listening on SoD stream.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Out(Logs::General, Logs::Error, "ClientManager fatal error: couldn't open SoD stream.");
|
||||
run_server = false;
|
||||
}
|
||||
sod_stream->OnNewConnection([this](std::shared_ptr<EQ::Net::EQStream> stream) {
|
||||
Log.OutF(Logs::General, Logs::Login_Server, "New SoD client connection from {0}:{1}", stream->RemoteEndpoint(), stream->GetRemotePort());
|
||||
stream->SetOpcodeManager(&sod_ops);
|
||||
Client *c = new Client(stream, cv_sod);
|
||||
clients.push_back(c);
|
||||
});
|
||||
}
|
||||
|
||||
ClientManager::~ClientManager()
|
||||
{
|
||||
if(titanium_stream)
|
||||
{
|
||||
titanium_stream->Close();
|
||||
delete titanium_stream;
|
||||
}
|
||||
|
||||
@ -82,7 +77,6 @@ ClientManager::~ClientManager()
|
||||
|
||||
if(sod_stream)
|
||||
{
|
||||
sod_stream->Close();
|
||||
delete sod_stream;
|
||||
}
|
||||
|
||||
@ -95,31 +89,6 @@ ClientManager::~ClientManager()
|
||||
void ClientManager::Process()
|
||||
{
|
||||
ProcessDisconnect();
|
||||
std::shared_ptr<EQStreamInterface> cur = titanium_stream->Pop();
|
||||
while(cur)
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
Log.Out(Logs::General, Logs::Login_Server, "New Titanium client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&titanium_ops);
|
||||
Client *c = new Client(cur, cv_titanium);
|
||||
clients.push_back(c);
|
||||
cur = titanium_stream->Pop();
|
||||
}
|
||||
|
||||
cur = sod_stream->Pop();
|
||||
while(cur)
|
||||
{
|
||||
struct in_addr in;
|
||||
in.s_addr = cur->GetRemoteIP();
|
||||
Log.Out(Logs::General, Logs::Login_Server, "New SoD client connection from %s:%d", inet_ntoa(in), ntohs(cur->GetRemotePort()));
|
||||
|
||||
cur->SetOpcodeManager(&sod_ops);
|
||||
Client *c = new Client(cur, cv_sod);
|
||||
clients.push_back(c);
|
||||
cur = sod_stream->Pop();
|
||||
}
|
||||
|
||||
list<Client*>::iterator iter = clients.begin();
|
||||
while(iter != clients.end())
|
||||
|
||||
@ -20,8 +20,7 @@
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_type.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/net/eqstream.h"
|
||||
#include "client.h"
|
||||
#include <list>
|
||||
|
||||
@ -71,9 +70,9 @@ private:
|
||||
|
||||
list<Client*> clients;
|
||||
OpcodeManager *titanium_ops;
|
||||
EQStreamFactory *titanium_stream;
|
||||
EQ::Net::EQStreamManager *titanium_stream;
|
||||
OpcodeManager *sod_ops;
|
||||
EQStreamFactory *sod_stream;
|
||||
EQ::Net::EQStreamManager *sod_stream;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/types.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/platform.h"
|
||||
#include "../common/crash.h"
|
||||
@ -29,7 +29,6 @@
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
LoginServer server;
|
||||
EQEmuLogSys Log;
|
||||
bool run_server = true;
|
||||
@ -199,8 +198,8 @@ int main()
|
||||
Timer::SetCurrentTime();
|
||||
server.client_manager->Process();
|
||||
server.server_manager->Process();
|
||||
timeout_manager.CheckTimeouts();
|
||||
Sleep(100);
|
||||
EQ::EventLoop::Get().Process();
|
||||
Sleep(1);
|
||||
}
|
||||
|
||||
Log.Out(Logs::General, Logs::Login_Server, "Server Shutdown.");
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#define EQEMU_SERVERMANAGER_H
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/emu_tcp_connection.h"
|
||||
#include "../common/emu_tcp_server.h"
|
||||
#include "../common/servertalk.h"
|
||||
|
||||
@ -19,7 +19,6 @@
|
||||
#define EQEMU_WORLDSERVER_H
|
||||
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/emu_tcp_connection.h"
|
||||
#include "../common/emu_tcp_server.h"
|
||||
#include "../common/servertalk.h"
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include "../common/platform.h"
|
||||
@ -34,7 +33,6 @@
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
Database database;
|
||||
LFGuildManager lfguildmanager;
|
||||
std::string WorldShortName;
|
||||
@ -117,8 +115,7 @@ int main() {
|
||||
worldserver->AsyncConnect();
|
||||
}
|
||||
worldserver->Process();
|
||||
timeout_manager.CheckTimeouts();
|
||||
Sleep(100);
|
||||
Sleep(1);
|
||||
}
|
||||
Log.CloseFileLogs();
|
||||
}
|
||||
|
||||
@ -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}")
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -20,7 +20,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
//#include "../common/eq_stream.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "../common/timer.h"
|
||||
//#include "zoneserver.h"
|
||||
|
||||
@ -28,16 +28,12 @@
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/eq_packet.h"
|
||||
#include "../common/seperator.h"
|
||||
#include "../common/version.h"
|
||||
#include "../common/eqtime.h"
|
||||
#include "../common/timeoutmgr.h"
|
||||
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "../common/net/eqstream.h"
|
||||
|
||||
#include "../common/opcodemgr.h"
|
||||
#include "../common/guilds.h"
|
||||
#include "../common/eq_stream_ident.h"
|
||||
@ -90,7 +86,6 @@
|
||||
#include "ucs.h"
|
||||
#include "queryserv.h"
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
EmuTCPServer tcps;
|
||||
ClientList client_list;
|
||||
GroupLFPList LFPGroupList;
|
||||
@ -395,7 +390,7 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
EQ::Net::EQStreamManagerOptions opts(9000, false, true);
|
||||
EQ::Net::EQStreamManagerOptions opts(9000, false, false);
|
||||
EQ::Net::EQStreamManager eqsm(opts);
|
||||
|
||||
//register all the patches we have avaliable with the stream identifier.
|
||||
@ -492,8 +487,6 @@ int main(int argc, char** argv) {
|
||||
Log.Out(Logs::Detail, Logs::World_Server, "EQTime successfully saved.");
|
||||
}
|
||||
|
||||
//check for timeouts in other threads
|
||||
timeout_manager.CheckTimeouts();
|
||||
loginserverlist.Process();
|
||||
console_list.Process();
|
||||
zoneserver_list.Process();
|
||||
|
||||
@ -23,8 +23,6 @@
|
||||
#include "../common/features.h"
|
||||
#include "../common/queue.h"
|
||||
#include "../common/timer.h"
|
||||
#include "../common/eq_stream.h"
|
||||
#include "../common/eq_stream_factory.h"
|
||||
#include "../common/eq_packet_structs.h"
|
||||
#include "../common/mutex.h"
|
||||
#include "../common/version.h"
|
||||
@ -95,7 +93,6 @@
|
||||
volatile bool RunLoops = true;
|
||||
extern volatile bool is_zone_loaded;
|
||||
|
||||
TimeoutManager timeout_manager;
|
||||
NetConnection net;
|
||||
EntityList entity_list;
|
||||
WorldServer worldserver;
|
||||
@ -448,7 +445,7 @@ int main(int argc, char** argv) {
|
||||
if (!eqsf_open && Config->ZonePort != 0) {
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort);
|
||||
|
||||
EQ::Net::EQStreamManagerOptions opts(Config->ZonePort, false, true);
|
||||
EQ::Net::EQStreamManagerOptions opts(Config->ZonePort, false, false);
|
||||
eqsm.reset(new EQ::Net::EQStreamManager(opts));
|
||||
eqsf_open = true;
|
||||
|
||||
@ -479,9 +476,6 @@ int main(int argc, char** argv) {
|
||||
zoneupdate_timer.Trigger();
|
||||
}
|
||||
|
||||
//check for timeouts in other threads
|
||||
timeout_manager.CheckTimeouts();
|
||||
|
||||
if (worldserver.Connected()) {
|
||||
worldwasconnected = true;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user