mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 05:02:31 +00:00
Fix SCGI threading and added missing header.
This commit is contained in:
+4
-27
@@ -1,6 +1,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "rpc/scgi_task.h"
|
||||
#include <rak/error_number.h>
|
||||
#include <rak/socket_address.h>
|
||||
#include <sys/un.h>
|
||||
@@ -9,12 +8,12 @@
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/exceptions.h>
|
||||
|
||||
#include "utils/socket_fd.h"
|
||||
|
||||
#include "control.h"
|
||||
#include "globals.h"
|
||||
#include "scgi.h"
|
||||
#include "parse_commands.h"
|
||||
#include "rpc/scgi_task.h"
|
||||
#include "utils/socket_fd.h"
|
||||
|
||||
#include "rpc/scgi.h"
|
||||
|
||||
namespace rpc {
|
||||
|
||||
@@ -110,7 +109,6 @@ SCgi::event_read() {
|
||||
SCgiTask* task = std::find_if(m_task, m_task + max_tasks, std::mem_fn(&SCgiTask::is_available));
|
||||
|
||||
if (task == m_task + max_tasks) {
|
||||
// Ergh... just closing for now.
|
||||
fd.close();
|
||||
continue;
|
||||
}
|
||||
@@ -129,25 +127,4 @@ SCgi::event_error() {
|
||||
throw torrent::internal_error("SCGI listener port received an error event.");
|
||||
}
|
||||
|
||||
bool
|
||||
SCgi::receive_call(SCgiTask* task, const char* buffer, uint32_t length) {
|
||||
bool result = false;
|
||||
|
||||
torrent::utils::Thread::acquire_global_lock();
|
||||
torrent::main_thread()->interrupt();
|
||||
|
||||
switch (task->content_type()) {
|
||||
case rpc::SCgiTask::ContentType::JSON:
|
||||
result = rpc.process(RpcManager::RPCType::JSON, buffer, length, [task](const char* b, uint32_t l) { return task->receive_write(b, l); });
|
||||
break;
|
||||
case rpc::SCgiTask::ContentType::XML:
|
||||
result = rpc.process(RpcManager::RPCType::XML, buffer, length, [task](const char* b, uint32_t l) { return task->receive_write(b, l); });
|
||||
break;
|
||||
|
||||
}
|
||||
torrent::utils::Thread::release_global_lock();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user