From b6d52f0299a16c1ba32570a7d375e35dbbe1c625 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Tue, 13 Mar 2018 10:49:16 +0100 Subject: [PATCH 1/2] Fix formatting of mac address in error log --- src/network/room.cpp | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/network/room.cpp b/src/network/room.cpp index cd6f0bb780..f1ee9299e1 100644 --- a/src/network/room.cpp +++ b/src/network/room.cpp @@ -16,22 +16,6 @@ namespace Network { -std::string MacAddressToString(const MacAddress& address) { - std::stringstream result; - bool is_start = true; - for (const auto& octal : address) { - if (!is_start) { - result << ":"; - } - - result << std::hex << octal; - - is_start = false; - } - - return result.str(); -} - class Room::RoomImpl { public: // This MAC address is used to generate a 'Nintendo' like Mac address. @@ -424,9 +408,10 @@ void Room::RoomImpl::HandleWifiPacket(const ENetEvent* event) { if (member != members.end()) { enet_peer_send(member->peer, 0, enet_packet); } else { - std::string formatted_address = MacAddressToString(destination_address); - LOG_ERROR(Network, "Attempting to send to unknown MAC address: %s", - formatted_address.c_str()); + LOG_ERROR(Network, + "Attempting to send to unknown MAC address: %02X:%02X:%02X:%02X:%02X:%02X", + destination_address[0], destination_address[1], destination_address[2], + destination_address[3], destination_address[4], destination_address[5]); enet_packet_destroy(enet_packet); } } From fd20c8c321b471ef7867c3989075d0a564f17a93 Mon Sep 17 00:00:00 2001 From: B3n30 Date: Tue, 13 Mar 2018 11:00:05 +0100 Subject: [PATCH 2/2] remove MacAddressToString --- src/network/room.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/network/room.h b/src/network/room.h index 5b5ab19e03..cf7364e244 100644 --- a/src/network/room.h +++ b/src/network/room.h @@ -45,9 +45,6 @@ constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; // 802.11 broadcast MAC address constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; -/// Converts a MAC address to a string representation. -std::string MacAddressToString(const MacAddress& address); - // The different types of messages that can be sent. The first byte of each packet defines the type enum RoomMessageTypes : u8 { IdJoinRequest = 1,