mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Added headless connection stuff, fixing connecting with daybreakconnections
This commit is contained in:
@@ -103,6 +103,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
log_settings[Logs::Crash].log_to_console = Logs::General;
|
||||
log_settings[Logs::MySQLError].log_to_console = Logs::General;
|
||||
log_settings[Logs::Login_Server].log_to_console = Logs::General;
|
||||
log_settings[Logs::Headless_Client].log_to_console = Logs::General;
|
||||
|
||||
/* Declare process file names for log writing
|
||||
If there is no process_file_name declared, no log file will be written, simply
|
||||
@@ -119,6 +120,8 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
platform_file_name = "login";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformLaunch)
|
||||
platform_file_name = "launcher";
|
||||
else if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformHC)
|
||||
platform_file_name = "hc";
|
||||
}
|
||||
|
||||
std::string EQEmuLogSys::FormatOutMessageString(uint16 log_category, const std::string &in_message)
|
||||
|
||||
@@ -84,6 +84,7 @@ namespace Logs {
|
||||
Client_Server_Packet_With_Dump,
|
||||
Login_Server,
|
||||
Client_Login,
|
||||
Headless_Client,
|
||||
MaxCategoryID /* Don't Remove this*/
|
||||
};
|
||||
|
||||
|
||||
@@ -105,16 +105,23 @@ void EQ::Net::DaybreakConnectionManager::Process()
|
||||
auto status = connection->m_status;
|
||||
|
||||
if (status == StatusDisconnecting) {
|
||||
connection->ChangeStatus(StatusDisconnected);
|
||||
iter = m_connections.erase(iter);
|
||||
connection->ChangeStatus(StatusDisconnected);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (status == StatusConnecting || status == StatusConnected) {
|
||||
if (status == StatusConnecting) {
|
||||
auto time_since_last_recv = std::chrono::duration_cast<std::chrono::milliseconds>(now - connection->m_last_recv);
|
||||
if ((size_t)time_since_last_recv.count() > m_options.connect_stale_ms) {
|
||||
iter = m_connections.erase(iter);
|
||||
connection->ChangeStatus(StatusDisconnected);
|
||||
continue;
|
||||
}
|
||||
} else if (status == StatusConnected) {
|
||||
auto time_since_last_recv = std::chrono::duration_cast<std::chrono::milliseconds>(now - connection->m_last_recv);
|
||||
if ((size_t)time_since_last_recv.count() > m_options.stale_connection_ms) {
|
||||
connection->ChangeStatus(StatusDisconnected);
|
||||
iter = m_connections.erase(iter);
|
||||
connection->ChangeStatus(StatusDisconnected);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -288,6 +295,9 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
||||
m_buffered_packets_length = 0;
|
||||
m_resend_delay = m_owner->m_options.resend_delay_ms;
|
||||
m_rolling_ping = 100;
|
||||
m_combined.reset(new char[512]);
|
||||
m_combined[0] = 0;
|
||||
m_combined[1] = OP_Combined;
|
||||
m_last_session_stats = Clock::now();
|
||||
}
|
||||
|
||||
@@ -554,6 +564,23 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_SessionResponse:
|
||||
{
|
||||
if (m_status == StatusConnecting) {
|
||||
auto reply = p.GetSerialize<DaybreakConnectReply>(0);
|
||||
|
||||
if (m_connect_code == reply.connect_code) {
|
||||
m_encode_key = reply.encode_key;
|
||||
m_crc_bytes = reply.crc_bytes;
|
||||
m_encode_passes[0] = (DaybreakEncodeType)reply.encode_pass1;
|
||||
m_encode_passes[1] = (DaybreakEncodeType)reply.encode_pass2;
|
||||
m_max_packet_size = reply.max_packet_size;
|
||||
ChangeStatus(StatusConnected);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case OP_Packet:
|
||||
case OP_Packet2:
|
||||
case OP_Packet3:
|
||||
|
||||
@@ -221,8 +221,9 @@ namespace EQ
|
||||
resend_delay_ms = 25;
|
||||
resend_delay_factor = 1.5;
|
||||
stats_delay_ms = 9000;
|
||||
connect_delay_ms = 1000;
|
||||
connect_delay_ms = 250;
|
||||
stale_connection_ms = 30000;
|
||||
connect_stale_ms = 5000;
|
||||
crc_length = 2;
|
||||
max_packet_size = 512;
|
||||
encode_passes[0] = DaybreakEncodeType::EncodeNone;
|
||||
@@ -242,6 +243,7 @@ namespace EQ
|
||||
size_t resend_delay_ms;
|
||||
size_t stats_delay_ms;
|
||||
size_t connect_delay_ms;
|
||||
size_t connect_stale_ms;
|
||||
size_t stale_connection_ms;
|
||||
size_t crc_length;
|
||||
size_t hold_size;
|
||||
|
||||
@@ -19,12 +19,15 @@ EQ::Net::ServertalkLegacyClient::~ServertalkLegacyClient()
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::Send(uint16_t opcode, EQ::Net::Packet &p)
|
||||
{
|
||||
if (!m_connection)
|
||||
return;
|
||||
|
||||
EQ::Net::DynamicPacket out;
|
||||
out.PutUInt16(0, opcode);
|
||||
out.PutUInt16(2, p.Length());
|
||||
out.PutUInt16(2, p.Length() + 4);
|
||||
out.PutPacket(4, p);
|
||||
|
||||
InternalSend(ServertalkMessage, out);
|
||||
m_connection->Write((const char*)out.Data(), out.Length());
|
||||
}
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::SendPacket(ServerPacket *p)
|
||||
@@ -75,21 +78,6 @@ void EQ::Net::ServertalkLegacyClient::ProcessData(EQ::Net::TCPConnection *c, con
|
||||
ProcessReadBuffer();
|
||||
}
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::InternalSend(ServertalkPacketType type, EQ::Net::Packet &p)
|
||||
{
|
||||
if (!m_connection)
|
||||
return;
|
||||
|
||||
EQ::Net::DynamicPacket out;
|
||||
out.PutUInt32(0, (uint32_t)p.Length());
|
||||
out.PutUInt8(4, (uint8_t)type);
|
||||
if (p.Length() > 0) {
|
||||
out.PutPacket(5, p);
|
||||
}
|
||||
|
||||
m_connection->Write((const char*)out.Data(), out.Length());
|
||||
}
|
||||
|
||||
void EQ::Net::ServertalkLegacyClient::ProcessReadBuffer()
|
||||
{
|
||||
size_t current = 0;
|
||||
@@ -110,7 +98,12 @@ void EQ::Net::ServertalkLegacyClient::ProcessReadBuffer()
|
||||
}
|
||||
|
||||
opcode = *(uint16_t*)&m_buffer[current];
|
||||
length = *(uint16_t*)&m_buffer[current + 2] - 4;
|
||||
length = *(uint16_t*)&m_buffer[current + 2];
|
||||
if (length < 4) {
|
||||
break;
|
||||
}
|
||||
|
||||
length -= 4;
|
||||
|
||||
if (current + 4 + length > total) {
|
||||
break;
|
||||
|
||||
@@ -25,7 +25,6 @@ namespace EQ
|
||||
private:
|
||||
void Connect();
|
||||
void ProcessData(EQ::Net::TCPConnection *c, const unsigned char *data, size_t length);
|
||||
void InternalSend(ServertalkPacketType type, EQ::Net::Packet &p);
|
||||
void ProcessReadBuffer();
|
||||
|
||||
std::unique_ptr<EQ::Timer> m_timer;
|
||||
|
||||
+2
-1
@@ -13,7 +13,8 @@ enum EQEmuExePlatform
|
||||
ExePlatformLaunch,
|
||||
ExePlatformSharedMemory,
|
||||
ExePlatformClientImport,
|
||||
ExePlatformClientExport
|
||||
ExePlatformClientExport,
|
||||
ExePlatformHC
|
||||
};
|
||||
|
||||
void RegisterExecutablePlatform(EQEmuExePlatform p);
|
||||
|
||||
+7
-7
@@ -528,13 +528,13 @@ struct ServerLSPlayerZoneChange_Struct {
|
||||
};
|
||||
|
||||
struct ClientAuth_Struct {
|
||||
int lsaccount_id; // ID# in login server's db
|
||||
std::string name; // username in login server's db
|
||||
std::string key; // the Key the client will present
|
||||
int lsadmin; // login server admin level
|
||||
int worldadmin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
std::string ip;
|
||||
int local; // 1 if the client is from the local network
|
||||
uint32 lsaccount_id; // ID# in login server's db
|
||||
char name[30]; // username in login server's db
|
||||
char key[30]; // the Key the client will present
|
||||
uint8 lsadmin; // login server admin level
|
||||
int16 worldadmin; // login's suggested worldadmin level setting for this user, up to the world if they want to obey it
|
||||
uint32 ip;
|
||||
uint8 local; // 1 if the client is from the local network
|
||||
|
||||
template <class Archive>
|
||||
void serialize(Archive &ar)
|
||||
|
||||
Reference in New Issue
Block a user