terence zhang / Mbed OS mbed-os-example-wakaama

Dependencies:   C12832 LM75B

Revision:
14:ec9e195830ff
Parent:
3:a280069151ac
--- a/wakaama/registration.c	Wed May 03 11:13:02 2017 +0000
+++ b/wakaama/registration.c	Sat May 06 11:21:27 2017 +0000
@@ -124,7 +124,7 @@
     if (targetP->status == STATE_REG_PENDING)
     {
         time_t tv_sec = lwm2m_gettime();
-        if (tv_sec >= 0)
+        if (tv_sec != NULL)
         {
             targetP->registration = tv_sec;
         }
@@ -180,7 +180,9 @@
 
     if (server->sessionH == NULL)
     {
-        server->sessionH = lwm2m_connect_server(server->secObjInstID, contextP->userData);
+        //server->sessionH = lwm2m_connect_server(server->secObjInstID, contextP->userData);
+        printf("server->sessionH == NULL\n");
+        return COAP_500_INTERNAL_SERVER_ERROR;
     }
 
     if (NULL == server->sessionH) return COAP_503_SERVICE_UNAVAILABLE;
@@ -213,7 +215,7 @@
     if (targetP->status == STATE_REG_UPDATE_PENDING)
     {
         time_t tv_sec = lwm2m_gettime();
-        if (tv_sec >= 0)
+        if (tv_sec != NULL)
         {
             targetP->registration = tv_sec;
         }
@@ -1225,7 +1227,6 @@
         case STATE_REG_FAILED:
             if (targetP->sessionH != NULL)
             {
-                lwm2m_close_connection(targetP->sessionH, contextP->userData);
                 targetP->sessionH = NULL;
             }
             break;