mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-06-01 20:25:21 -06:00
NetFixes : workaround for Epolls on P2P sockets (#3933)
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
* return error on P2P sockets * error message improved
This commit is contained in:
parent
dce9c04383
commit
220e5f67e7
@ -655,10 +655,17 @@ int PS4_SYSV_ABI sceNetEpollControl(OrbisNetId epollid, OrbisNetEpollFlag op, Or
|
|||||||
|
|
||||||
switch (file->type) {
|
switch (file->type) {
|
||||||
case Core::FileSys::FileType::Socket: {
|
case Core::FileSys::FileType::Socket: {
|
||||||
|
auto native_handle = file->socket->Native();
|
||||||
|
if (!native_handle) {
|
||||||
|
// P2P socket, cannot be added to epoll
|
||||||
|
LOG_ERROR(Lib_Net, "P2P socket cannot be added to epoll (unimplemented)");
|
||||||
|
*sceNetErrnoLoc() = ORBIS_NET_EBADF;
|
||||||
|
return ORBIS_NET_ERROR_EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
epoll_event native_event = {.events = ConvertEpollEventsIn(event->events),
|
epoll_event native_event = {.events = ConvertEpollEventsIn(event->events),
|
||||||
.data = {.fd = id}};
|
.data = {.fd = id}};
|
||||||
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_ADD, *file->socket->Native(),
|
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_ADD, *native_handle, &native_event) == 0);
|
||||||
&native_event) == 0);
|
|
||||||
epoll->events.emplace_back(id, *event);
|
epoll->events.emplace_back(id, *event);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -696,10 +703,17 @@ int PS4_SYSV_ABI sceNetEpollControl(OrbisNetId epollid, OrbisNetEpollFlag op, Or
|
|||||||
|
|
||||||
switch (file->type) {
|
switch (file->type) {
|
||||||
case Core::FileSys::FileType::Socket: {
|
case Core::FileSys::FileType::Socket: {
|
||||||
|
auto native_handle = file->socket->Native();
|
||||||
|
if (!native_handle) {
|
||||||
|
// P2P socket, cannot be modified in epoll
|
||||||
|
LOG_ERROR(Lib_Net, "P2P socket cannot be modified in epoll (unimplemented)");
|
||||||
|
*sceNetErrnoLoc() = ORBIS_NET_EBADF;
|
||||||
|
return ORBIS_NET_ERROR_EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
epoll_event native_event = {.events = ConvertEpollEventsIn(event->events),
|
epoll_event native_event = {.events = ConvertEpollEventsIn(event->events),
|
||||||
.data = {.fd = id}};
|
.data = {.fd = id}};
|
||||||
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_MOD, *file->socket->Native(),
|
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_MOD, *native_handle, &native_event) == 0);
|
||||||
&native_event) == 0);
|
|
||||||
*it = {id, *event};
|
*it = {id, *event};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -731,8 +745,15 @@ int PS4_SYSV_ABI sceNetEpollControl(OrbisNetId epollid, OrbisNetEpollFlag op, Or
|
|||||||
|
|
||||||
switch (file->type) {
|
switch (file->type) {
|
||||||
case Core::FileSys::FileType::Socket: {
|
case Core::FileSys::FileType::Socket: {
|
||||||
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_DEL, *file->socket->Native(), nullptr) ==
|
auto native_handle = file->socket->Native();
|
||||||
0);
|
if (!native_handle) {
|
||||||
|
// P2P socket, cannot be removed from epoll
|
||||||
|
LOG_ERROR(Lib_Net, "P2P socket cannot be removed from epoll (unimplemented)");
|
||||||
|
*sceNetErrnoLoc() = ORBIS_NET_EBADF;
|
||||||
|
return ORBIS_NET_ERROR_EBADF;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(epoll_ctl(epoll->epoll_fd, EPOLL_CTL_DEL, *native_handle, nullptr) == 0);
|
||||||
epoll->events.erase(it);
|
epoll->events.erase(it);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user