diff options
| author | 2025-10-28 14:44:43 +0000 | |
|---|---|---|
| committer | 2025-10-28 14:44:43 +0000 | |
| commit | 2fc2872d8b0459d6bbe9c32f368bb92d3c86269b (patch) | |
| tree | 79b03f1d051576386155cd91bfbb16a908c1d6ce /src/users.cpp | |
| parent | Avoid duplicating some of the send/receive queue limiting code. (diff) | |
Move message serialization into core_clients.
Diffstat (limited to 'src/users.cpp')
| -rw-r--r-- | src/users.cpp | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/users.cpp b/src/users.cpp index a57704879..9f65e945d 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -590,28 +590,6 @@ void LocalUser::ChangeConnectClass(const std::shared_ptr<ConnectClass>& klass, b FOREACH_MOD(OnPostChangeConnectClass, (this, force)); } -void LocalUser::Write(const ClientProtocol::SerializedMessage& text) -{ - if (text.empty()) - return; - - if (ServerInstance->Config->RawLog) - { - std::string::size_type nlpos = text.find_first_of("\r\n", 0, 2); - if (nlpos == std::string::npos) - nlpos = text.length(); - - ServerInstance->Logs.RawIO("USEROUTPUT", "C[{}] O {}", uuid, std::string_view(text.c_str(), nlpos)); - } - - this->io->Write(text); - - const size_t bytessent = text.length() + 2; - ServerInstance->Stats.Sent += bytessent; - this->bytes_out += bytessent; - this->cmds_out++; -} - void LocalUser::Send(ClientProtocol::Event& protoev) { if (!serializer) @@ -646,8 +624,13 @@ void LocalUser::Send(ClientProtocol::Event& protoev, ClientProtocol::MessageList ClientProtocol::Message& curr = *msg; ModResult res; FIRST_MOD_RESULT(OnUserWrite, res, (this, curr)); - if (res != MOD_RES_DENY) - Write(serializer->SerializeForUser(this, curr)); + if (res == MOD_RES_DENY) + continue; + + const auto bytessent = this->io->Write(curr); + ServerInstance->Stats.Sent += bytessent; + this->bytes_out += bytessent; + this->cmds_out++; } } |
