Removed unused add/remove error-event code.

This commit is contained in:
Jari Sundell
2026-07-06 20:05:20 +02:00
committed by GitHub
parent fa351c017d
commit ea2d22cb87
6 changed files with 11 additions and 11 deletions
-1
View File
@@ -13,7 +13,6 @@ void
InputEvent::insert() { InputEvent::insert() {
torrent::this_thread::poll()->open(this); torrent::this_thread::poll()->open(this);
torrent::this_thread::poll()->insert_read(this); torrent::this_thread::poll()->insert_read(this);
torrent::this_thread::poll()->insert_error(this);
} }
void void
+1 -1
View File
@@ -11,7 +11,7 @@ class InputEvent : public torrent::Event {
public: public:
typedef std::function<void (int)> slot_int; typedef std::function<void (int)> slot_int;
InputEvent(int fd) { m_fileDesc = fd; } InputEvent(int fd) { set_file_descriptor(fd); }
const char* type_name() const override { return "input"; } const char* type_name() const override { return "input"; }
+3
View File
@@ -1,5 +1,6 @@
#include "config.h" #include "config.h"
#include <cassert>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <fcntl.h> #include <fcntl.h>
@@ -24,6 +25,8 @@ namespace rpc {
int int
ExecFile::execute(const char* file, char* const* argv, int flags) { ExecFile::execute(const char* file, char* const* argv, int flags) {
assert(!((flags & flag_capture) && (flags & flag_background)));
// Write the executed command and its parameters to the log fd. // Write the executed command and its parameters to the log fd.
[[maybe_unused]] int result; [[maybe_unused]] int result;
-1
View File
@@ -111,7 +111,6 @@ SCgi::activate() {
torrent::this_thread::poll()->open(this); torrent::this_thread::poll()->open(this);
torrent::this_thread::poll()->insert_read(this); torrent::this_thread::poll()->insert_read(this);
torrent::this_thread::poll()->insert_error(this);
} }
// TODO: This should close the fd to avoid reuse. // TODO: This should close the fd to avoid reuse.
+5 -6
View File
@@ -27,7 +27,7 @@ namespace rpc {
SCgiTask::SCgiTask() SCgiTask::SCgiTask()
: m_callback_id(torrent::system::make_callback_id()) { : m_callback_id(torrent::system::make_callback_id()) {
set_file_descriptor(-1); reset_file_descriptor();
} }
void void
@@ -49,7 +49,6 @@ SCgiTask::open(SCgi* parent, int fd) {
torrent::this_thread::poll()->open(this); torrent::this_thread::poll()->open(this);
torrent::this_thread::poll()->insert_read(this); torrent::this_thread::poll()->insert_read(this);
torrent::this_thread::poll()->insert_error(this);
auto lock = std::lock_guard<std::mutex>(m_result_mutex); auto lock = std::lock_guard<std::mutex>(m_result_mutex);
@@ -65,7 +64,7 @@ SCgiTask::cancel_open() {
torrent::this_thread::poll()->remove_and_close(this); torrent::this_thread::poll()->remove_and_close(this);
torrent::fd_close(file_descriptor()); torrent::fd_close(file_descriptor());
set_file_descriptor(-1); reset_file_descriptor();
}; };
void void
@@ -79,7 +78,7 @@ SCgiTask::close() {
torrent::this_thread::poll()->remove_and_close(this); torrent::this_thread::poll()->remove_and_close(this);
torrent::fd_close(file_descriptor()); torrent::fd_close(file_descriptor());
set_file_descriptor(-1); reset_file_descriptor();
}); });
// The callbacks are guaranteed to be finished/canceled at this point. // The callbacks are guaranteed to be finished/canceled at this point.
@@ -98,7 +97,7 @@ SCgiTask::event_read() {
if (read_length <= 0) if (read_length <= 0)
throw torrent::internal_error("SCgiTask::event_read() no space in buffer for event_read."); throw torrent::internal_error("SCgiTask::event_read() no space in buffer for event_read.");
int bytes = ::recv(m_fileDesc, m_buffer.data() + m_position, read_length, 0); int bytes = ::recv(file_descriptor(), m_buffer.data() + m_position, read_length, 0);
if (bytes <= 0) { if (bytes <= 0) {
if (bytes == 0 || !(errno == EAGAIN || errno == EINTR)) if (bytes == 0 || !(errno == EAGAIN || errno == EINTR))
@@ -181,7 +180,7 @@ event_read_failed:
void void
SCgiTask::event_write() { SCgiTask::event_write() {
int bytes = ::send(m_fileDesc, m_buffer.data() + m_position, m_buffer.size() - m_position, 0); int bytes = ::send(file_descriptor(), m_buffer.data() + m_position, m_buffer.size() - m_position, 0);
if (bytes == -1) { if (bytes == -1) {
if (!(errno == EAGAIN || errno == EINTR)) if (!(errno == EAGAIN || errno == EINTR))
+2 -2
View File
@@ -22,8 +22,8 @@ public:
const char* type_name() const override { return "scgi-task"; } const char* type_name() const override { return "scgi-task"; }
bool is_open() const { return m_fileDesc != -1; } bool is_open() const { return file_descriptor() != -1; }
bool is_available() const { return m_fileDesc == -1; } bool is_available() const { return file_descriptor() == -1; }
void open(SCgi* parent, int fd); void open(SCgi* parent, int fd);
void cancel_open(); void cancel_open();