DEV9: Correct ICMP log messages

This commit is contained in:
TheLastRar 2024-07-12 18:21:47 +01:00 committed by lightningterror
parent 54782cbf70
commit ab008bf5d0
1 changed files with 9 additions and 9 deletions

View File

@ -299,7 +299,7 @@ namespace Sessions
if (ret == -1) if (ret == -1)
{ {
hasData = false; hasData = false;
Console.WriteLn("DEV9: ICMP: select failed. Error Code: %d", errno); Console.WriteLn("DEV9: ICMP: select failed. Error: %d", errno);
} }
else if (FD_ISSET(icmpSocket, &sExcept)) else if (FD_ISSET(icmpSocket, &sExcept))
{ {
@ -309,9 +309,9 @@ namespace Sessions
socklen_t len = sizeof(error); socklen_t len = sizeof(error);
if (getsockopt(icmpSocket, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&error), &len) < 0) if (getsockopt(icmpSocket, SOL_SOCKET, SO_ERROR, reinterpret_cast<char*>(&error), &len) < 0)
Console.Error("DEV9: ICMP: Unknown ICMP Connection Error (getsockopt Error: %d)", errno); Console.Error("DEV9: ICMP: Unknown ICMP connection error (getsockopt error: %d)", errno);
else else
Console.Error("DEV9: ICMP: Recv Error: %d", error); Console.Error("DEV9: ICMP: Recv error: %d", error);
} }
else else
hasData = FD_ISSET(icmpSocket, &sReady); hasData = FD_ISSET(icmpSocket, &sReady);
@ -440,7 +440,7 @@ namespace Sessions
} }
else else
{ {
Console.Error("DEV9: ICMP: Recv Error %d", exError.ee_errno); Console.Error("DEV9: ICMP: Recv error %d", exError.ee_errno);
result.type = -1; result.type = -1;
result.code = exError.ee_errno; result.code = exError.ee_errno;
return &result; return &result;
@ -560,7 +560,7 @@ namespace Sessions
if (ret != ERROR_IO_PENDING) if (ret != ERROR_IO_PENDING)
{ {
Console.Error("DEV9: ICMP: Failed to Send Echo, %d", GetLastError()); Console.Error("DEV9: ICMP: Failed to send echo, %d", GetLastError());
return false; return false;
} }
@ -655,7 +655,7 @@ namespace Sessions
const int ret = sendto(icmpSocket, buffer.get(), icmp.GetLength(), 0, reinterpret_cast<const sockaddr*>(&endpoint), sizeof(endpoint)); const int ret = sendto(icmpSocket, buffer.get(), icmp.GetLength(), 0, reinterpret_cast<const sockaddr*>(&endpoint), sizeof(endpoint));
if (ret == -1) if (ret == -1)
{ {
Console.Error("DEV9: ICMP: Send Error %d", errno); Console.Error("DEV9: ICMP: Send error %d", errno);
::close(icmpSocket); ::close(icmpSocket);
icmpSocket = -1; icmpSocket = -1;
return false; return false;
@ -758,12 +758,12 @@ namespace Sessions
// Free ping // Free ping
delete ping; delete ping;
if (--open == 0)
RaiseEventConnectionClosed();
if (ret.has_value()) if (ret.has_value())
DevCon.WriteLn("DEV9: ICMP: Return Ping"); DevCon.WriteLn("DEV9: ICMP: Return Ping");
if (--open == 0)
RaiseEventConnectionClosed();
// Return packet // Return packet
return ret; return ret;
} }