Own fork of MbedSmartRest

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of MbedSmartRest by Cumulocity Official

Revision:
18:16192696c106
Parent:
17:b3a4b4bdfc59
Child:
19:81dfc04ce0bb
--- a/MbedClient.cpp	Wed Mar 04 09:35:25 2015 +0000
+++ b/MbedClient.cpp	Fri Mar 06 10:37:09 2015 +0000
@@ -153,19 +153,22 @@
 {
     if ((_state != STATE_IN_REQUEST) &&
         (_state != STATE_SENT_ID) &&
-        (_state != STATE_SENT_DATA))
+        (_state != STATE_SENT_DATA)) {
         return internalError();
+    }
     
     MBCL_DBG("\033[32mMbedClient:\033[39m Ending request.\r\n");
 
     if (_state != STATE_SENT_DATA) {
         // send end of headers
-        if (!send("\r\n"))
+        if (!send("\r\n")) {
             return connectionError();
+        }
     }
     
-    if (!_sink.flush())
+    if (!_sink.flush()) {
         return connectionError();
+    }
     
     _state = STATE_REQ_COMPLETE;
     return CLIENT_OK;
@@ -173,22 +176,23 @@
 
 uint8_t MbedClient::awaitResponse()
 {
-    uint8_t status;
-
-    if (_state != STATE_REQ_COMPLETE)
+    if (_state != STATE_REQ_COMPLETE) {
         return internalError();
+    }
     
     MBCL_DBG("\033[32mMbedClient:\033[39m Awaiting response...\r\n");
 
-    status = _filter.readStatus();
+    uint8_t status = _filter.readStatus();
     MBCL_DBG("\033[32mMbedClient:\033[39m Status code: %u\r\n", status);
 
-    if ((status != 200) || (!_filter.skipHeaders()))
+    if ((status != 200) || (!_filter.skipHeaders())) {
         return connectionError();
-
+    }
+    
     // set timeout to fifteen minutes if stream request flag set
-    if (_isStreamRequest)
-        _source.setTimeout(900000);
+//    if (_isStreamRequest) {
+//        _source.setTimeout(900000);
+//    }
     
     _state = STATE_RECVD_RESPONSE;
     return CLIENT_OK;