debug version
Dependents: HTTPClient_WiFi_HelloWorld_src
Fork of SNICInterface by
Diff: Socket/TCPSocketServer.cpp
- Revision:
- 43:d80bbb12ffe6
- Parent:
- 41:1c1b5ad4d491
- Child:
- 45:50d60753ade3
--- 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; }