final 1
Fork of C027_Support by
Diff: MDM.cpp
- Revision:
- 66:69072b3c5bca
- Parent:
- 65:dd94f920a762
- Child:
- 68:33a96cf64986
diff -r dd94f920a762 -r 69072b3c5bca MDM.cpp --- a/MDM.cpp Tue May 13 14:41:03 2014 +0000 +++ b/MDM.cpp Tue May 13 15:56:28 2014 +0000 @@ -189,7 +189,8 @@ // relax a bit WAIT_MS(10); } - while (timer.read_ms() < timeout_ms); + while ((timeout_ms == TIMEOUT_BLOCKING) || + (timer.read_ms() < timeout_ms)); timer.stop(); timer.reset(); return WAIT; @@ -706,7 +707,7 @@ // successfull _sockets[socket].state = SOCK_CREATED; _sockets[socket].pending = 0; - _sockets[socket].timeout_ms = 0; // non blocking + _sockets[socket].timeout_ms = TIMEOUT_BLOCKING; return socket; } @@ -735,7 +736,7 @@ return _sockets[socket].state == SOCK_CONNECTED; } -bool MDMParser::socketSetBlocking(int socket, unsigned int timeout_ms) +bool MDMParser::socketSetBlocking(int socket, int timeout_ms) { TRACE("socketSetBlocking(%d,%d)\r\n", socket, timeout_ms); if (!ISSOCKET(socket)) @@ -844,7 +845,7 @@ buf += blk; _sockets[socket].pending -= blk; } else if ((_sockets[socket].state == SOCK_CONNECTED) && ( - (_sockets[socket].timeout_ms == (unsigned int)-1 /* blocking */) || + (_sockets[socket].timeout_ms == TIMEOUT_BLOCKING) || (timer.read_ms() < _sockets[socket].timeout_ms))){ // allow to receive unsolicited commands waitFinalResp(NULL, NULL, 10); @@ -900,7 +901,7 @@ cnt += blk; buf += blk; _sockets[socket].pending -= blk; - } else if ((_sockets[socket].timeout_ms == (unsigned int)-1 /* blocking */) || + } else if ((_sockets[socket].timeout_ms == TIMEOUT_BLOCKING) || (timer.read_ms() < _sockets[socket].timeout_ms)) { // allow to receive unsolicited commands waitFinalResp(NULL, NULL, 10);