mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 09:00:40 +02:00
Async: Move ownership of file descriptors out of poll_reactor
This commit is contained in:
1 parent
6e9d5f00de
commit
43dcc84c07
5 files changed
+94
-60
No files matched your search
@@ -210,14 +210,21 @@ bool InitializeServerSocket(bool abstract) {
|
||||
}
|
||||
|
||||
int FD = Socket->FD;
|
||||
Reactor.callbacks[FD] = [Socket = std::move(Socket).value()](fasio::error ec) mutable {
|
||||
Reactor.bind_handler(
|
||||
pollfd {
|
||||
.fd = FD,
|
||||
.events = POLLIN | POLLPRI | POLLRDHUP,
|
||||
.revents = 0,
|
||||
},
|
||||
[Socket = std::move(Socket).value()](fasio::error ec) mutable {
|
||||
if (ec != fasio::error::success) {
|
||||
close(Socket.FD);
|
||||
return fasio::post_callback::drop;
|
||||
}
|
||||
HandleSocketData(Socket);
|
||||
// Wait for next data
|
||||
return fasio::post_callback::repeat;
|
||||
};
|
||||
});
|
||||
|
||||
// Wait for next connection
|
||||
return fasio::post_callback::repeat;
|
||||
|
||||
Reference in new issue
Block a user