Use libtorrent's fd_set_nonblock helper

This commit is contained in:
zqmfb
2026-03-25 18:30:56 -04:00
committed by Jari Sundell
parent 8d50aee96f
commit 2711e4c044
+1 -2
View File
@@ -84,8 +84,7 @@ SCgi::open_named(const std::string& filename) {
void void
SCgi::open_fd(int fd) { SCgi::open_fd(int fd) {
torrent::runtime::socket_manager()->open_event_or_throw(this, [&]() { torrent::runtime::socket_manager()->open_event_or_throw(this, [&]() {
int flags = ::fcntl(fd, F_GETFL, 0); if (!torrent::fd_set_nonblock(fd))
if (flags == -1 || ::fcntl(fd, F_SETFL, flags | O_NONBLOCK) == -1)
throw torrent::resource_error("Could not set non-blocking on systemd fd: " + throw torrent::resource_error("Could not set non-blocking on systemd fd: " +
std::string(std::strerror(errno))); std::string(std::strerror(errno)));
set_file_descriptor(fd); set_file_descriptor(fd);