Customized
Dependents: MurataTypeYD_RPC_Sample
Fork of SNICInterface_mod by
Diff: Socket/TCPSocketServer.cpp
- Revision:
- 43:d80bbb12ffe6
- Parent:
- 41:1c1b5ad4d491
- Child:
- 48:e3a26a484d1c
--- a/Socket/TCPSocketServer.cpp Fri Sep 19 01:46:17 2014 +0000 +++ b/Socket/TCPSocketServer.cpp Fri Nov 14 00:52:31 2014 +0000 @@ -37,12 +37,14 @@ C_SNIC_Core *snic_core_p = C_SNIC_Core::getInstance(); C_SNIC_UartCommandManager *uartCmdMgr_p = snic_core_p->getUartCommand(); + snic_core_p->lockAPI(); // Get local ip address. // Get buffer for response payload from MemoryPool tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { DEBUG_PRINT("bind payload_buf_p NULL\r\n"); + snic_core_p->unlockAPI(); return -1; } @@ -65,6 +67,7 @@ { DEBUG_PRINT( "bind failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); return -1; } @@ -72,10 +75,12 @@ { DEBUG_PRINT("bind status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); return -1; } snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); unsigned int local_addr = (payload_buf_p->buf[9] << 24) | (payload_buf_p->buf[10] << 16) @@ -98,11 +103,13 @@ C_SNIC_Core *snic_core_p = C_SNIC_Core::getInstance(); C_SNIC_UartCommandManager *uartCmdMgr_p = snic_core_p->getUartCommand(); + snic_core_p->lockAPI(); // Get buffer for response payload from MemoryPool tagMEMPOOL_BLOCK_T *payload_buf_p = snic_core_p->allocCmdBuf(); if( payload_buf_p == NULL ) { DEBUG_PRINT("listen payload_buf_p NULL\r\n"); + snic_core_p->unlockAPI(); return -1; } @@ -132,6 +139,7 @@ { DEBUG_PRINT( "listen failed\r\n" ); snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); return -1; } @@ -139,10 +147,12 @@ { DEBUG_PRINT("listen status:%02x\r\n", uartCmdMgr_p->getCommandStatus()); snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); return -1; } snic_core_p->freeCmdBuf( payload_buf_p ); + snic_core_p->unlockAPI(); return 0; }