Merge pull request #14409 from sepalani/tri-rw-log

AMMediaboard: Improve recv/send log messages
This commit is contained in:
JMC47 2026-03-12 21:51:29 -04:00 committed by GitHub
commit d4e97f6bd7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1002,10 +1002,25 @@ static void AMMBCommandRecv(u32 parameter_offset, u32 network_buffer_base)
len = 0;
}
// TODO: Might be blocking depending on the timeout (see SetTimeouts command).
const int ret = recv(fd, reinterpret_cast<char*>(s_network_buffer.data() + off), len, 0);
const int err = WSAGetLastError();
DEBUG_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: recv( {}, 0x{:08x}, {} ):{} {}", fd, off, len, ret, err);
if (ret < 0 && err != WSAEWOULDBLOCK)
{
ERROR_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: recv( {}, 0x{:08x}, {} ) failed with error {}: {}", fd,
off, len, err, Common::DecodeNetworkError(err));
}
else if (ret == 0)
{
INFO_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: recv( {}, 0x{:08x}, {} ):0 shutdown received", fd, off,
len);
}
else
{
DEBUG_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: recv( {}, 0x{:08x}, {} ):{} {}", fd, off, len, ret,
err);
}
s_media_buffer[1] = s_media_buffer[8];
s_media_buffer_32[1] = ret;
@ -1031,11 +1046,20 @@ static void AMMBCommandSend(u32 parameter_offset, u32 network_buffer_base)
len = 0;
}
// TODO: Might be blocking depending on the timeout (see SetTimeouts command).
const int ret = send(fd, reinterpret_cast<char*>(s_network_buffer.data() + off), len, SEND_FLAGS);
const int err = WSAGetLastError();
DEBUG_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: send( {}({}), 0x{:08x}, {} ): {} {}", fd,
u32(guest_socket), off, len, ret, err);
if (ret < 0 && err != WSAEWOULDBLOCK)
{
ERROR_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: send( {}({}), 0x{:08x}, {} ) failed with error {}: {}",
fd, u32(guest_socket), off, len, err, Common::DecodeNetworkError(err));
}
else
{
DEBUG_LOG_FMT(AMMEDIABOARD_NET, "GC-AM: send( {}({}), 0x{:08x}, {} ): {} {}", fd,
u32(guest_socket), off, len, ret, err);
}
s_media_buffer[1] = s_media_buffer[8];
s_media_buffer_32[1] = ret;