MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / SendError

Method SendError

src/network/network_admin.cpp:130–145  ·  view source on GitHub ↗

* Send an error to the admin. * @param error The error to send. */

Source from the content-addressed store, hash-verified

128 * @param error The error to send.
129 */
130NetworkRecvStatus ServerNetworkAdminSocketHandler::SendError(NetworkErrorCode error)
131{
132 /* Whatever the error might be, authentication (keys) must be released as soon as possible. */
133 this->authentication_handler = nullptr;
134
135 auto p = std::make_unique<Packet>(this, ADMIN_PACKET_SERVER_ERROR);
136
137 p->Send_uint8(error);
138 this->SendPacket(std::move(p));
139
140 std::string error_message = GetString(GetNetworkErrorMsg(error));
141
142 Debug(net, 1, "[admin] The admin '{}' ({}) made an error and has been disconnected: '{}'", this->admin_name, this->admin_version, error_message);
143
144 return this->CloseConnection(true);
145}
146
147/** Send the protocol version to the admin. */
148NetworkRecvStatus ServerNetworkAdminSocketHandler::SendProtocol()

Callers 11

Receive_ADMIN_RCONMethod · 0.95
Receive_ADMIN_PINGMethod · 0.95
Receive_ADMIN_JOINMethod · 0.95
Receive_ADMIN_POLLMethod · 0.95
Receive_ADMIN_CHATMethod · 0.95
SendEnableEncryptionMethod · 0.95

Calls 5

GetNetworkErrorMsgFunction · 0.85
GetStringFunction · 0.50
Send_uint8Method · 0.45
SendPacketMethod · 0.45
CloseConnectionMethod · 0.45

Tested by

no test coverage detected