mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-05 17:52:29 +00:00
Use libtorrent's fd_set_nonblock helper
This commit is contained in:
+1
-2
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user