Added per-category allocation limits to SocketManager by @trim21

This commit is contained in:
Trim21
2026-05-27 17:16:02 +08:00
committed by GitHub
parent 64881317c6
commit 3d7e6cb077
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -292,7 +292,7 @@ initialize_command_network() {
CMD2_ANY ("network.total_handshakes", [](auto, auto) { return torrent::runtime::total_handshakes(); });
CMD2_ANY ("network.open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->size(); });
CMD2_ANY ("network.max_open_sockets", [](auto, auto) { return torrent::runtime::socket_manager()->max_size(); });
CMD2_ANY_VALUE_V ("network.max_open_sockets.set", [](auto, auto& value) { return torrent::runtime::socket_manager()->set_max_size(value); });
CMD2_ANY_VALUE_V ("network.max_open_sockets.set", [](auto, auto& value) { return torrent::runtime::socket_manager()->set_max_size_and_adjust(value); });
CMD2_ANY_STRING ("network.scgi.open_port", std::bind(&apply_scgi, std::placeholders::_2, 1));
CMD2_ANY_STRING ("network.scgi.open_local", std::bind(&apply_scgi, std::placeholders::_2, 2));
+4 -4
View File
@@ -48,7 +48,7 @@ SCgi::open_port(sockaddr* sa, unsigned int length, bool dont_route) {
open(reinterpret_cast<sockaddr*>(sa), length);
torrent::runtime::socket_manager()->register_event_or_throw(this, []() {});
torrent::runtime::socket_manager()->register_event_or_throw(this, torrent::runtime::SocketManager::category_scgi, []() {});
}
void
@@ -72,7 +72,7 @@ SCgi::open_named(const std::string& filename) {
open(reinterpret_cast<sockaddr*>(sa), offsetof(struct sockaddr_un, sun_path) + filename.size() + 1);
torrent::runtime::socket_manager()->register_event_or_throw(this, []() {});
torrent::runtime::socket_manager()->register_event_or_throw(this, torrent::runtime::SocketManager::category_scgi, []() {});
m_path = filename;
}
@@ -86,7 +86,7 @@ SCgi::open_fd(int fd) {
// fd is already bound and listening; no bind()/listen() needed.
torrent::runtime::socket_manager()->register_event_or_throw(this, []() {});
torrent::runtime::socket_manager()->register_event_or_throw(this, torrent::runtime::SocketManager::category_scgi, []() {});
}
void
@@ -183,7 +183,7 @@ SCgi::event_read() {
task->cancel_open();
};
bool result = torrent::runtime::socket_manager()->open_event_or_cleanup(m_current->get(), open_func, cleanup_func);
bool result = torrent::runtime::socket_manager()->open_event_or_cleanup(m_current->get(), torrent::runtime::SocketManager::category_scgi, open_func, cleanup_func);
if (!result)
break;