Own fork of MbedSmartRest

Dependents:   MbedSmartRestMain MbedSmartRestMain

Fork of MbedSmartRest by Cumulocity Official

Revision:
18:16192696c106
Parent:
11:e1bee9a77652
Child:
20:505d29d5bdfc
--- a/MbedDataSource.cpp	Wed Mar 04 09:35:25 2015 +0000
+++ b/MbedDataSource.cpp	Fri Mar 06 10:37:09 2015 +0000
@@ -44,8 +44,9 @@
 char MbedDataSource::read()
 {
     while (_offset == _len) {
-        if (!receive())
+        if (!receive()) {
             return 0;
+        }
     }
     
     return _buf[_offset++];
@@ -69,15 +70,14 @@
 
 bool MbedDataSource::receive()
 {
-    int ret;
-
     if (status() != DS_STATUS_OK)
         return false;
     
-    _sock.set_blocking(true, _timeout);
-    ret = _sock.receive(_buf, MBED_SOURCE_BUFFER_SIZE);
+//    _sock.set_blocking(true, _timeout);
+    _sock.set_blocking(false, 300000); 
+    int ret = _sock.receive(_buf, MBED_SOURCE_BUFFER_SIZE);
     
-    if (ret < 0) {
+    if (ret <= 0) {
         _isTimedOut = true;
         return false;
     }