Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
Diff: mbed/mod/ModJsonRpc.cpp
- Revision:
- 81:e5e4f2264d24
- Parent:
- 76:b375b3d750d8
- Child:
- 85:416f8bbbdf54
--- a/mbed/mod/ModJsonRpc.cpp Tue Jun 24 09:42:07 2014 +0000
+++ b/mbed/mod/ModJsonRpc.cpp Tue Jun 24 14:34:39 2014 +0000
@@ -44,17 +44,23 @@
ModBaseClass::setParam(i_path);
this->_rpc_table=i_rpc_table;
}
-
+ bool ModJsonRpc::isStarted(){
+ return this->_mod!=NULL;
+ }
bool ModJsonRpc::execute(HttpdConnection& i_connection)
{
+ i_connection.lockHttpd();
if(this->_mod!=NULL){
+ i_connection.unlockHttpd();
return false;
}
this->_mod=(NyLPC_TcModJsonRpc_t*)malloc(sizeof(NyLPC_TcModJsonRpc_t));
+ i_connection.unlockHttpd();
+
if(this->_mod==NULL){
return false;
}
-
+
//initialize websocket
NyLPC_cModJsonRpc_initialize(this->_mod,this->_path,this->_rpc_table);
if(NyLPC_cModJsonRpc_canHandle(this->_mod,i_connection._ref_inst)){
@@ -66,7 +72,9 @@
}
NyLPC_cModJsonRpc_finalize(this->_mod);
free(this->_mod);
+ i_connection.lockHttpd();
this->_mod=NULL;
+ i_connection.unlockHttpd();
return false;
}
