mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-27 21:56:42 +00:00
Merge pull request #3515 from B3n30/fix_format_libnetwork
Fix formatting of mac address in error log
This commit is contained in:
commit
5748b3e47f
|
@ -16,22 +16,6 @@
|
||||||
|
|
||||||
namespace Network {
|
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 {
|
class Room::RoomImpl {
|
||||||
public:
|
public:
|
||||||
// This MAC address is used to generate a 'Nintendo' like Mac address.
|
// 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()) {
|
if (member != members.end()) {
|
||||||
enet_peer_send(member->peer, 0, enet_packet);
|
enet_peer_send(member->peer, 0, enet_packet);
|
||||||
} else {
|
} else {
|
||||||
std::string formatted_address = MacAddressToString(destination_address);
|
LOG_ERROR(Network,
|
||||||
LOG_ERROR(Network, "Attempting to send to unknown MAC address: %s",
|
"Attempting to send to unknown MAC address: %02X:%02X:%02X:%02X:%02X:%02X",
|
||||||
formatted_address.c_str());
|
destination_address[0], destination_address[1], destination_address[2],
|
||||||
|
destination_address[3], destination_address[4], destination_address[5]);
|
||||||
enet_packet_destroy(enet_packet);
|
enet_packet_destroy(enet_packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,9 +45,6 @@ constexpr MacAddress NoPreferredMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
||||||
// 802.11 broadcast MAC address
|
// 802.11 broadcast MAC address
|
||||||
constexpr MacAddress BroadcastMac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
|
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
|
// The different types of messages that can be sent. The first byte of each packet defines the type
|
||||||
enum RoomMessageTypes : u8 {
|
enum RoomMessageTypes : u8 {
|
||||||
IdJoinRequest = 1,
|
IdJoinRequest = 1,
|
||||||
|
|
Loading…
Reference in a new issue