only get src_adr if input_adr available
This commit is contained in:
parent
e8bb79be2d
commit
0e89555a89
|
@ -580,13 +580,19 @@ void SOC_U::RecvFrom(Kernel::HLERequestContext& ctx) {
|
||||||
std::vector<u8> addr_buff(sizeof(ctr_src_addr));
|
std::vector<u8> addr_buff(sizeof(ctr_src_addr));
|
||||||
sockaddr src_addr;
|
sockaddr src_addr;
|
||||||
socklen_t src_addr_len = sizeof(src_addr);
|
socklen_t src_addr_len = sizeof(src_addr);
|
||||||
s32 ret = ::recvfrom(socket_handle, reinterpret_cast<char*>(output_buff.data()), len, flags,
|
|
||||||
&src_addr, &src_addr_len);
|
|
||||||
|
|
||||||
if (ret >= 0 && src_addr_len > 0) {
|
s32 ret = -1;
|
||||||
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
|
if (addr_len > 0) {
|
||||||
std::memcpy(addr_buff.data(), &ctr_src_addr, sizeof(ctr_src_addr));
|
// Only get src adr if input adr available
|
||||||
|
ret = ::recvfrom(socket_handle, reinterpret_cast<char*>(output_buff.data()), len, flags,
|
||||||
|
&src_addr, &src_addr_len);
|
||||||
|
if (ret >= 0 && src_addr_len > 0) {
|
||||||
|
ctr_src_addr = CTRSockAddr::FromPlatform(src_addr);
|
||||||
|
std::memcpy(addr_buff.data(), &ctr_src_addr, sizeof(ctr_src_addr));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
ret = ::recvfrom(socket_handle, reinterpret_cast<char*>(output_buff.data()), len, flags,
|
||||||
|
NULL, 0);
|
||||||
addr_buff.resize(0);
|
addr_buff.resize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue