Added multithreading
This commit is contained in:
@@ -4,16 +4,15 @@
|
||||
#include <string>
|
||||
#include <csignal>
|
||||
#include <fstream>
|
||||
|
||||
#include <regex>
|
||||
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/enable_shared_from_this.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/asio.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include <cctype> // is*
|
||||
|
||||
//#define DEBUG
|
||||
|
||||
using namespace std;
|
||||
@@ -439,7 +438,11 @@ int main(int argc, char* argv[])
|
||||
|
||||
acceptor.accept_connections();
|
||||
|
||||
ios.run();
|
||||
boost::thread_group tg;
|
||||
for (unsigned i = 0; i < thread::hardware_concurrency(); ++i)
|
||||
tg.create_thread(boost::bind(&boost::asio::io_service::run, &ios));
|
||||
|
||||
tg.join_all();
|
||||
}
|
||||
catch(exception& e)
|
||||
{
|
||||
|
||||
72
backend/proxy/test
Normal file
72
backend/proxy/test
Normal file
@@ -0,0 +1,72 @@
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
1C3733353138303461313162386234323563313931613664373937666264356630
|
||||
1S3733353138303461313162386234323563313931613664373937666264356630
|
||||
1C3065376433366539666631353833373263633764613966396235313538633766
|
||||
1S3065376433366539666631353833373263633764613966396235313538633766
|
||||
1C3638316561366437356466353765656265383933396630326262393338336438
|
||||
1S3638316561366437356466353765656265383933396630326262393338336438
|
||||
1C3739663566343265663536633261656665623338346135616464633539663930
|
||||
1S3739663566343265663536633261656665623338346135616464633539663930
|
||||
@@ -153,9 +153,8 @@ class ProxyManager:
|
||||
self.__update_status_db(id, next_status)
|
||||
if saved_status[0] == "wait": saved_status[0] = next_status
|
||||
proxy_status = proxy.start(in_pause=(next_status==STATUS.PAUSE))
|
||||
if proxy_status != 0:
|
||||
saved_status[0] = STATUS.STOP
|
||||
self.__update_status_db(id, STATUS.STOP)
|
||||
saved_status[0] = STATUS.STOP
|
||||
self.__update_status_db(id, STATUS.STOP)
|
||||
return
|
||||
else:
|
||||
time.sleep(.5)
|
||||
|
||||
Reference in New Issue
Block a user