diff --git a/common/eq_stream_intf.h b/common/eq_stream_intf.h index 17a025a18..68a25f41c 100644 --- a/common/eq_stream_intf.h +++ b/common/eq_stream_intf.h @@ -27,7 +27,6 @@ struct EQStreamManagerInterfaceOptions EQStreamManagerInterfaceOptions(int port, bool encoded, bool compressed) { opcode_size = 2; - track_opcode_stats = false; //World seems to support both compression and xor zone supports one or the others. //Enforce one or the other in the convienence construct @@ -54,8 +53,9 @@ public: EQStreamManagerInterface(const EQStreamManagerInterfaceOptions &options) { m_options = options; } virtual ~EQStreamManagerInterface() { }; + EQStreamManagerInterfaceOptions GetOptions() { return m_options; } const EQStreamManagerInterfaceOptions& GetOptions() const { return m_options; } - EQStreamManagerInterfaceOptions& MutateOptions() { return m_options; } + virtual void SetOptions(const EQStreamManagerInterfaceOptions& options) = 0; protected: EQStreamManagerInterfaceOptions m_options; }; diff --git a/common/net/daybreak_connection.cpp b/common/net/daybreak_connection.cpp index 375841211..de5f03a7b 100644 --- a/common/net/daybreak_connection.cpp +++ b/common/net/daybreak_connection.cpp @@ -368,6 +368,7 @@ void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliab packet.PutUInt8(0, 0); packet.PutPacket(1, p); InternalQueuePacket(packet, stream, reliable); + return; } InternalQueuePacket(p, stream, reliable); @@ -384,7 +385,7 @@ EQ::Net::DaybreakConnectionStats EQ::Net::DaybreakConnection::GetStats() void EQ::Net::DaybreakConnection::ResetStats() { - m_stats = DaybreakConnectionStats(); + m_stats.Reset(); } void EQ::Net::DaybreakConnection::Process() @@ -417,6 +418,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) auto opcode = p.GetInt8(1); if (p.GetInt8(0) == 0 && (opcode == OP_KeepAlive || opcode == OP_OutboundPing)) { + m_stats.bytes_after_decode += p.Length(); return; } @@ -425,6 +427,8 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) if (m_owner->m_on_error_message) { m_owner->m_on_error_message(fmt::format("Tossed packet that failed CRC of type {0:#x}", p.Length() >= 2 ? p.GetInt8(1) : 0)); } + + m_stats.bytes_after_decode += p.Length(); return; } @@ -453,6 +457,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) } } + m_stats.bytes_after_decode += temp.Length(); ProcessDecodedPacket(StaticPacket(temp.Data(), temp.Length())); } else { @@ -471,10 +476,12 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) } } + m_stats.bytes_after_decode += temp.Length(); ProcessDecodedPacket(StaticPacket(temp.Data(), temp.Length())); } } else { + m_stats.bytes_after_decode += p.Length(); ProcessDecodedPacket(p); } } @@ -1285,6 +1292,9 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) }; if (PacketCanBeEncoded(p)) { + + m_stats.bytes_before_encode += p.Length(); + DynamicPacket out; out.PutPacket(0, p); @@ -1332,6 +1342,8 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) return; } + m_stats.bytes_before_encode += p.Length(); + uv_udp_send_t *send_req = new uv_udp_send_t; sockaddr_in send_addr; uv_ip4_addr(m_endpoint.c_str(), m_port, &send_addr); diff --git a/common/net/daybreak_connection.h b/common/net/daybreak_connection.h index ab3c759c8..4d2f62e27 100644 --- a/common/net/daybreak_connection.h +++ b/common/net/daybreak_connection.h @@ -91,6 +91,24 @@ namespace EQ resent_fragments = 0; resent_full = 0; datarate_remaining = 0.0; + bytes_after_decode = 0; + bytes_before_encode = 0; + } + + void Reset() { + recv_bytes = 0; + sent_bytes = 0; + min_ping = 0xFFFFFFFFFFFFFFFFUL; + max_ping = 0; + avg_ping = 0; + created = Clock::now(); + dropped_datarate_packets = 0; + resent_packets = 0; + resent_fragments = 0; + resent_full = 0; + datarate_remaining = 0.0; + bytes_after_decode = 0; + bytes_before_encode = 0; } uint64_t recv_bytes; @@ -111,6 +129,8 @@ namespace EQ uint64_t resent_fragments; uint64_t resent_full; double datarate_remaining; + uint64_t bytes_after_decode; + uint64_t bytes_before_encode; }; class DaybreakConnectionManager; diff --git a/common/net/eqstream.cpp b/common/net/eqstream.cpp index c30e1ef85..9df0ea17e 100644 --- a/common/net/eqstream.cpp +++ b/common/net/eqstream.cpp @@ -13,6 +13,13 @@ EQ::Net::EQStreamManager::~EQStreamManager() { } +void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options) +{ + m_options = options; + auto &opts = m_daybreak.GetOptions(); + opts = options.daybreak_options; +} + void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr connection) { std::shared_ptr stream(new EQStream(this, connection)); @@ -65,9 +72,7 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req) opcode = p->GetOpcodeBypass(); } else { - if (m_owner->GetOptions().track_opcode_stats) { - m_packet_sent_count[p->GetOpcode()]++; //Wont bother with bypass tracking of these since those are rare for testing anyway - } + m_packet_sent_count[p->GetOpcode()]++; //Wont bother with bypass tracking of these since those are rare for testing anyway opcode = (*m_opcode_manager)->EmuToEQ(p->GetOpcode()); } @@ -117,9 +122,7 @@ EQApplicationPacket *EQ::Net::EQStream::PopPacket() { } EmuOpcode emu_op = (*m_opcode_manager)->EQToEmu(opcode); - if (m_owner->GetOptions().track_opcode_stats) { - m_packet_recv_count[emu_op]++; - } + m_packet_recv_count[emu_op]++; EQApplicationPacket *ret = new EQApplicationPacket(emu_op, (unsigned char*)p->Data() + m_owner->GetOptions().opcode_size, p->Length() - m_owner->GetOptions().opcode_size); ret->SetProtocolOpcode(opcode); diff --git a/common/net/eqstream.h b/common/net/eqstream.h index 1d253d4f6..09ffbe509 100644 --- a/common/net/eqstream.h +++ b/common/net/eqstream.h @@ -19,6 +19,7 @@ namespace EQ EQStreamManager(const EQStreamManagerInterfaceOptions &options); ~EQStreamManager(); + virtual void SetOptions(const EQStreamManagerInterfaceOptions& options); void OnNewConnection(std::function)> func) { m_on_new_connection = func; } void OnConnectionStateChange(std::function, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; } private: diff --git a/common/ruletypes.h b/common/ruletypes.h index aad194bb4..01e75d66d 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -683,10 +683,10 @@ RULE_CATEGORY_END() RULE_CATEGORY(Network) RULE_INT(Network, ResendDelayBaseMS, 100) RULE_REAL(Network, ResendDelayFactor, 1.5) -RULE_INT(Network, ResendDelayMinMS, 100) +RULE_INT(Network, ResendDelayMinMS, 300) RULE_INT(Network, ResendDelayMaxMS, 5000) RULE_REAL(Network, ClientDataRate, 0.0) // KB / sec, 0.0 disabled -RULE_BOOL(Network, TrackOpcodeStats, false) +RULE_BOOL(Network, CompressZoneStream, true) RULE_CATEGORY_END() RULE_CATEGORY(QueryServ) diff --git a/common/serverinfo.cpp b/common/serverinfo.cpp index aaa13e7ab..db31e9561 100644 --- a/common/serverinfo.cpp +++ b/common/serverinfo.cpp @@ -15,109 +15,80 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -// Serverinfo.cpp - Server information gathering functions, used in #serverinfo - Windows specific -// I'm not sure quite how to get this exact information in *nix, hopefully someone can fill that in -// -T7g -// Implement preliminary support for *nix variants -// misanthropicfiend -#ifdef _WINDOWS -#include +#include "serverinfo.h" +#include -char Ver_name[100]; -DWORD Ver_build, Ver_min, Ver_maj, Ver_pid; +size_t EQ::GetRSS() +{ + size_t rss = 0; -int GetOS() { - - strcpy(Ver_name, "Unknown operating system"); - - OSVERSIONINFO Ver_os; - Ver_os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - - if(!(GetVersionEx(&Ver_os))) return 1; - - Ver_build = Ver_os.dwBuildNumber & 0xFFFF; - Ver_min = Ver_os.dwMinorVersion; - Ver_maj = Ver_os.dwMajorVersion; - Ver_pid = Ver_os.dwPlatformId; - - if ((Ver_pid == 1) && (Ver_maj == 4)) - { - if ((Ver_min < 10) && (Ver_build == 950)) - { - strcpy(Ver_name, "Microsoft Windows 95"); - } - else if ((Ver_min < 10) && - ((Ver_build > 950) && (Ver_build <= 1080))) - { - strcpy(Ver_name, "Microsoft Windows 95 SP1"); - } - else if ((Ver_min < 10) && (Ver_build > 1080)) - { - strcpy(Ver_name, "Microsoft Windows 95 OSR2"); - } - else if ((Ver_min == 10) && (Ver_build == 1998)) - { - strcpy(Ver_name, "Microsoft Windows 98"); - } - else if ((Ver_min == 10) && - ((Ver_build > 1998) && (Ver_build < 2183))) - { - strcpy(Ver_name, "Microsoft Windows 98, Service Pack 1"); - } - else if ((Ver_min == 10) && (Ver_build >= 2183)) - { - strcpy(Ver_name, "Microsoft Windows 98 Second Edition"); - } - else if (Ver_min == 90) - { - strcpy(Ver_name, "Microsoft Windows ME"); - } - } - else if (Ver_pid == 2) - { - if ((Ver_maj == 3) && (Ver_min == 51)) - { - strcpy(Ver_name, "Microsoft Windows NT 3.51"); - } - else if ((Ver_maj == 4) && (Ver_min == 0)) - { - strcpy(Ver_name, "Microsoft Windows NT 4"); - } - else if ((Ver_maj == 5) && (Ver_min == 0)) - { - strcpy(Ver_name, "Microsoft Windows 2000"); - } - else if ((Ver_maj == 5) && (Ver_min == 1)) - { - strcpy(Ver_name, "Microsoft Windows XP"); - } - else if ((Ver_maj == 5) && (Ver_min == 2)) - { - strcpy(Ver_name, "Microsoft Windows 2003"); - } + if (0 != uv_resident_set_memory(&rss)) { + return 0; } - return 0; + return rss; } -#else +double EQ::GetUptime() +{ + double uptime = 0.0; -#include -#include -#include - -char* GetOS(char* os_string) { - utsname info; - - if(uname(&info)==0) { - snprintf(os_string, 99, "%s %s %s %s %s", info.sysname, info.nodename, info.release, info.version, info.machine); - } else { - strncpy(os_string, "Error determining OS & version!", 25); + if (0 != uv_uptime(&uptime)) { + return 0.0; } - return os_string; - + return uptime; } -#endif +size_t EQ::GetPID() +{ + return uv_os_getpid(); +} + +std::vector EQ::GetCPUs() +{ + std::vector ret; + uv_cpu_info_t *cpu_info = nullptr; + int count = 0; + + if (0 != uv_cpu_info(&cpu_info, &count)) { + return ret; + } + + ret.reserve(count); + for (int i = 0; i < count; ++i) { + eq_cpu_info_t r; + auto &entry = cpu_info[i]; + + r.model = entry.model; + r.speed = entry.speed / 1000.0; + r.time_user = entry.cpu_times.user; + r.time_sys = entry.cpu_times.sys; + r.time_idle = entry.cpu_times.idle; + r.time_nice = entry.cpu_times.nice; + r.time_irq = entry.cpu_times.irq; + + ret.push_back(r); + } + + uv_free_cpu_info(cpu_info, count); + return ret; +} + +eq_utsname_t EQ::GetOS() +{ + eq_utsname_t ret; + uv_utsname_t name; + + if (0 != uv_os_uname(&name)) { + return ret; + } + + ret.machine = name.machine; + ret.release = name.release; + ret.sysname = name.sysname; + ret.version = name.version; + + return ret; +} diff --git a/common/serverinfo.h b/common/serverinfo.h index 14425e6af..7405714b3 100644 --- a/common/serverinfo.h +++ b/common/serverinfo.h @@ -15,15 +15,33 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#ifndef SERVERINFO_H -#define SERVERINFO_H +#pragma once -#ifdef _WINDOWS - extern char Ver_name[36]; - extern DWORD Ver_build, Ver_min, Ver_maj, Ver_pid; - int GetOS(); -#else - char* GetOS(char* os_string); -#endif +#include +#include -#endif +typedef struct eq_cpu_info_s { + std::string model; + double speed; + uint64_t time_user; + uint64_t time_nice; + uint64_t time_sys; + uint64_t time_idle; + uint64_t time_irq; +} eq_cpu_info_t; + +typedef struct eq_utsname_s { + std::string sysname; + std::string release; + std::string version; + std::string machine; +} eq_utsname_t; + +namespace EQ +{ + size_t GetRSS(); + double GetUptime(); + size_t GetPID(); + std::vector GetCPUs(); + eq_utsname_t GetOS(); +} diff --git a/zone/command.cpp b/zone/command.cpp index c0fff47d2..03bb612df 100755 --- a/zone/command.cpp +++ b/zone/command.cpp @@ -845,18 +845,32 @@ void command_setanim(Client *c, const Seperator *sep) void command_serverinfo(Client *c, const Seperator *sep) { -#ifdef _WINDOWS - char intbuffer [sizeof(unsigned long)]; - c->Message(0, "Operating system information."); - c->Message(0, " %s", Ver_name); - c->Message(0, " Build number: %s", ultoa(Ver_build, intbuffer, 10)); - c->Message(0, " Minor version: %s", ultoa(Ver_min, intbuffer, 10)); - c->Message(0, " Major version: %s", ultoa(Ver_maj, intbuffer, 10)); - c->Message(0, " Platform Id: %s", ultoa(Ver_pid, intbuffer, 10)); -#else -char buffer[255]; - c->Message(0, "Operating system information: %s", GetOS(buffer)); -#endif + auto os = EQ::GetOS(); + auto cpus = EQ::GetCPUs(); + auto pid = EQ::GetPID(); + auto rss = EQ::GetRSS(); + auto uptime = EQ::GetUptime(); + + c->Message(0, "Operating System Information"); + c->Message(0, "=================================================="); + c->Message(0, "System: %s", os.sysname.c_str()); + c->Message(0, "Release: %s", os.release.c_str()); + c->Message(0, "Version: %s", os.version.c_str()); + c->Message(0, "Machine: %s", os.machine.c_str()); + c->Message(0, "Uptime: %.2f seconds", uptime); + c->Message(0, "=================================================="); + c->Message(0, "CPU Information"); + c->Message(0, "=================================================="); + for (size_t i = 0; i < cpus.size(); ++i) { + auto &cp = cpus[i]; + c->Message(0, "CPU #%i: %s, Speed: %.2fGhz", i, cp.model.c_str(), cp.speed); + } + c->Message(0, "=================================================="); + c->Message(0, "Process Information"); + c->Message(0, "=================================================="); + c->Message(0, "PID: %u", pid); + c->Message(0, "RSS: %.2f MB", rss / 1048576.0); + c->Message(0, "=================================================="); } void command_getvariable(Client *c, const Seperator *sep) @@ -9505,6 +9519,10 @@ void command_netstats(Client *c, const Seperator *sep) c->Message(0, "--------------------------------------------------------------------"); c->Message(0, "Sent Bytes: %u (%.2f/sec)", stats.sent_bytes, stats.sent_bytes / sec_since_stats_reset); c->Message(0, "Recv Bytes: %u (%.2f/sec)", stats.recv_bytes, stats.recv_bytes / sec_since_stats_reset); + c->Message(0, "Bytes Before Encode (Sent): %u, Compression Rate: %.2f%%", stats.bytes_before_encode, + static_cast(stats.bytes_before_encode - stats.sent_bytes) / static_cast(stats.bytes_before_encode) * 100.0); + c->Message(0, "Bytes After Decode (Recv): %u, Compression Rate: %.2f%%", stats.bytes_after_decode, + static_cast(stats.bytes_after_decode - stats.recv_bytes) / static_cast(stats.bytes_after_decode) * 100.0); c->Message(0, "Min Ping: %u", stats.min_ping); c->Message(0, "Max Ping: %u", stats.max_ping); c->Message(0, "Last Ping: %u", stats.last_ping); @@ -9528,7 +9546,7 @@ void command_netstats(Client *c, const Seperator *sep) c->Message(0, "Outgoing Link Saturation %.2f%% (%.2fkb/sec)", 100.0 * (1.0 - ((opts.daybreak_options.outgoing_data_rate - stats.datarate_remaining) / opts.daybreak_options.outgoing_data_rate)), opts.daybreak_options.outgoing_data_rate); } - if (opts.track_opcode_stats) { + if (strcasecmp(sep->arg[1], "full") == 0) { c->Message(0, "--------------------------------------------------------------------"); c->Message(0, "Sent Packet Types"); for (auto i = 0; i < _maxEmuOpcode; ++i) { @@ -12222,27 +12240,27 @@ void command_network(Client *c, const Seperator *sep) if (!strcasecmp(sep->arg[2], "all")) { - c->Message(0, "max_packet_size: %llu", opts.daybreak_options.max_packet_size); - c->Message(0, "max_connection_count: %llu", opts.daybreak_options.max_connection_count); - c->Message(0, "keepalive_delay_ms: %llu", opts.daybreak_options.keepalive_delay_ms); + c->Message(0, "max_packet_size: %llu", (uint64_t)opts.daybreak_options.max_packet_size); + c->Message(0, "max_connection_count: %llu", (uint64_t)opts.daybreak_options.max_connection_count); + c->Message(0, "keepalive_delay_ms: %llu", (uint64_t)opts.daybreak_options.keepalive_delay_ms); c->Message(0, "resend_delay_factor: %.2f", opts.daybreak_options.resend_delay_factor); - c->Message(0, "resend_delay_ms: %llu", opts.daybreak_options.resend_delay_ms); - c->Message(0, "resend_delay_min: %llu", opts.daybreak_options.resend_delay_min); - c->Message(0, "resend_delay_max: %llu", opts.daybreak_options.resend_delay_max); - c->Message(0, "connect_delay_ms: %llu", opts.daybreak_options.connect_delay_ms); - c->Message(0, "connect_stale_ms: %llu", opts.daybreak_options.connect_stale_ms); - c->Message(0, "stale_connection_ms: %llu", opts.daybreak_options.stale_connection_ms); - c->Message(0, "crc_length: %llu", opts.daybreak_options.crc_length); - c->Message(0, "hold_size: %llu", opts.daybreak_options.hold_size); - c->Message(0, "hold_length_ms: %llu", opts.daybreak_options.hold_length_ms); - c->Message(0, "simulated_in_packet_loss: %llu", opts.daybreak_options.simulated_in_packet_loss); - c->Message(0, "simulated_out_packet_loss: %llu", opts.daybreak_options.simulated_out_packet_loss); + c->Message(0, "resend_delay_ms: %llu", (uint64_t)opts.daybreak_options.resend_delay_ms); + c->Message(0, "resend_delay_min: %llu", (uint64_t)opts.daybreak_options.resend_delay_min); + c->Message(0, "resend_delay_max: %llu", (uint64_t)opts.daybreak_options.resend_delay_max); + c->Message(0, "connect_delay_ms: %llu", (uint64_t)opts.daybreak_options.connect_delay_ms); + c->Message(0, "connect_stale_ms: %llu", (uint64_t)opts.daybreak_options.connect_stale_ms); + c->Message(0, "stale_connection_ms: %llu", (uint64_t)opts.daybreak_options.stale_connection_ms); + c->Message(0, "crc_length: %llu", (uint64_t)opts.daybreak_options.crc_length); + c->Message(0, "hold_size: %llu", (uint64_t)opts.daybreak_options.hold_size); + c->Message(0, "hold_length_ms: %llu", (uint64_t)opts.daybreak_options.hold_length_ms); + c->Message(0, "simulated_in_packet_loss: %llu", (uint64_t)opts.daybreak_options.simulated_in_packet_loss); + c->Message(0, "simulated_out_packet_loss: %llu", (uint64_t)opts.daybreak_options.simulated_out_packet_loss); c->Message(0, "tic_rate_hertz: %.2f", opts.daybreak_options.tic_rate_hertz); - c->Message(0, "resend_timeout: %llu", opts.daybreak_options.resend_timeout); - c->Message(0, "connection_close_time: %llu", opts.daybreak_options.connection_close_time); - c->Message(0, "encode_passes[0]: %llu", opts.daybreak_options.encode_passes[0]); - c->Message(0, "encode_passes[1]: %llu", opts.daybreak_options.encode_passes[1]); - c->Message(0, "port: %llu", opts.daybreak_options.port); + c->Message(0, "resend_timeout: %llu", (uint64_t)opts.daybreak_options.resend_timeout); + c->Message(0, "connection_close_time: %llu", (uint64_t)opts.daybreak_options.connection_close_time); + c->Message(0, "encode_passes[0]: %llu", (uint64_t)opts.daybreak_options.encode_passes[0]); + c->Message(0, "encode_passes[1]: %llu", (uint64_t)opts.daybreak_options.encode_passes[1]); + c->Message(0, "port: %llu", (uint64_t)opts.daybreak_options.port); } else { c->Message(0, "Unknown get option: %s", sep->arg[2]); @@ -12276,7 +12294,7 @@ void command_network(Client *c, const Seperator *sep) { auto eqsi = c->Connection(); auto manager = eqsi->GetManager(); - auto &opts = manager->MutateOptions(); + auto &opts = manager->GetOptions(); if (!strcasecmp(sep->arg[3], "")) { @@ -12288,62 +12306,77 @@ void command_network(Client *c, const Seperator *sep) if (!strcasecmp(sep->arg[2], "max_connection_count")) { opts.daybreak_options.max_connection_count = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "keepalive_delay_ms")) { opts.daybreak_options.keepalive_delay_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "resend_delay_factor")) { opts.daybreak_options.resend_delay_factor = std::stod(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "resend_delay_ms")) { opts.daybreak_options.resend_delay_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "resend_delay_min")) { opts.daybreak_options.resend_delay_min = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "resend_delay_max")) { opts.daybreak_options.resend_delay_max = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "connect_delay_ms")) { opts.daybreak_options.connect_delay_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "connect_stale_ms")) { opts.daybreak_options.connect_stale_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "stale_connection_ms")) { opts.daybreak_options.stale_connection_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "hold_size")) { opts.daybreak_options.hold_size = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "hold_length_ms")) { opts.daybreak_options.hold_length_ms = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "simulated_in_packet_loss")) { opts.daybreak_options.simulated_in_packet_loss = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "simulated_out_packet_loss")) { opts.daybreak_options.simulated_out_packet_loss = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "resend_timeout")) { opts.daybreak_options.resend_timeout = std::stoull(value); + manager->SetOptions(opts); } else if (!strcasecmp(sep->arg[2], "connection_close_time")) { opts.daybreak_options.connection_close_time = std::stoull(value); + manager->SetOptions(opts); } else { c->Message(0, "Unknown set option: %s", sep->arg[2]); diff --git a/zone/eqemu_api_zone_data_service.cpp b/zone/eqemu_api_zone_data_service.cpp index cd6af042e..153153c0c 100644 --- a/zone/eqemu_api_zone_data_service.cpp +++ b/zone/eqemu_api_zone_data_service.cpp @@ -691,30 +691,27 @@ void callGetPacketStatistics(Json::Value &response) row["resent_non_fragments"] = stats.resent_full; row["dropped_datarate_packets"] = stats.dropped_datarate_packets; - if (opts.track_opcode_stats) { + Json::Value sent_packet_types; - Json::Value sent_packet_types; - - for (auto i = 0; i < _maxEmuOpcode; ++i) { - auto count = eqs_stats.SentCount[i]; - if (count > 0) { - sent_packet_types[OpcodeNames[i]] = count; - } + for (auto i = 0; i < _maxEmuOpcode; ++i) { + auto count = eqs_stats.SentCount[i]; + if (count > 0) { + sent_packet_types[OpcodeNames[i]] = count; } - - Json::Value receive_packet_types; - - for (auto i = 0; i < _maxEmuOpcode; ++i) { - auto count = eqs_stats.RecvCount[i]; - if (count > 0) { - receive_packet_types[OpcodeNames[i]] = count; - } - } - - row["sent_packet_types"] = sent_packet_types; - row["receive_packet_types"] = receive_packet_types; } + Json::Value receive_packet_types; + + for (auto i = 0; i < _maxEmuOpcode; ++i) { + auto count = eqs_stats.RecvCount[i]; + if (count > 0) { + receive_packet_types[OpcodeNames[i]] = count; + } + } + + row["sent_packet_types"] = sent_packet_types; + row["receive_packet_types"] = receive_packet_types; + response.append(row); } } @@ -776,4 +773,4 @@ void EQEmuApiZoneDataService::get(Json::Value &response, const std::vectorZonePort != 0) { Log(Logs::General, Logs::Zone_Server, "Starting EQ Network server on port %d", Config->ZonePort); - EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, true); + EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream)); opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS); opts.daybreak_options.resend_delay_factor = RuleR(Network, ResendDelayFactor); opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS); opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS); opts.daybreak_options.outgoing_data_rate = RuleR(Network, ClientDataRate); - opts.track_opcode_stats = RuleB(Network, TrackOpcodeStats); eqsm.reset(new EQ::Net::EQStreamManager(opts)); eqsf_open = true;