From 4ed1b4f267e9fddc7d4a29db3acc0d531c090d7f Mon Sep 17 00:00:00 2001 From: JoelKatz Date: Sat, 8 Dec 2012 19:54:32 -0800 Subject: [PATCH] Dispatch all websocket commands to our pool. This should fix the deadlocks. --- src/cpp/ripple/JobQueue.h | 8 ++++---- src/cpp/ripple/WSHandler.h | 7 ++++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cpp/ripple/JobQueue.h b/src/cpp/ripple/JobQueue.h index 884b9bf7b..43659f8e8 100644 --- a/src/cpp/ripple/JobQueue.h +++ b/src/cpp/ripple/JobQueue.h @@ -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, diff --git a/src/cpp/ripple/WSHandler.h b/src/cpp/ripple/WSHandler.h index 8d08df5dc..824c69061 100644 --- a/src/cpp/ripple/WSHandler.h +++ b/src/cpp/ripple/WSHandler.h @@ -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::do_message, this, _1, cpClient, mpMessage)); + } + + void do_message(Job&, connection_ptr cpClient, message_ptr mpMessage) + { Json::Value jvRequest; Json::Reader jrReader;