Dispatch all websocket commands to our pool. This should fix the deadlocks.

This commit is contained in:
JoelKatz
2012-12-08 19:54:32 -08:00
parent 66021ab284
commit 4ed1b4f267
2 changed files with 10 additions and 5 deletions

View File

@@ -21,10 +21,11 @@
enum JobType
{ // must be in priority order, low to high
jtINVALID = -1,
jtVALIDATION_ut = 0, // A validation from an untrusted source
jtVALIDATION_ut = 1, // A validation from an untrusted source
jtPROOFWORK = 2, // A proof of work demand from another server
jtTRANSACTION = 3, // A transaction received from the network
jtPROPOSAL_ut = 4, // A proposal from an untrusted source
jtPROPOSAL_ut = 3, // A proposal from an untrusted source
jtCLIENT = 4, // A websocket command from the client
jtTRANSACTION = 5, // A transaction received from the network
jtVALIDATION_t = 6, // A validation from a trusted source
jtTRANSACTION_l = 7, // A local transaction
jtPROPOSAL_t = 8, // A proposal from a trusted source
@@ -32,7 +33,6 @@ enum JobType
jtDEATH = 10, // job of death, used internally
// special types not dispatched by the job pool
jtCLIENT = 16,
jtPEER = 17,
jtDISK = 18,
jtRPC = 19,

View File

@@ -99,7 +99,12 @@ public:
void on_message(connection_ptr cpClient, message_ptr mpMessage)
{
LoadEvent::pointer event = theApp->getJobQueue().getLoadEvent(jtCLIENT);
theApp->getJobQueue().addJob(jtCLIENT,
boost::bind(&WSServerHandler<endpoint_type>::do_message, this, _1, cpClient, mpMessage));
}
void do_message(Job&, connection_ptr cpClient, message_ptr mpMessage)
{
Json::Value jvRequest;
Json::Reader jrReader;