ccollins476ad commented on a change in pull request #2300:
URL: https://github.com/apache/mynewt-core/pull/2300#discussion_r432210346



##########
File path: net/oic/src/messaging/coap/engine.c
##########
@@ -231,17 +231,19 @@ coap_receive(struct os_mbuf **mp)
             }
             transaction->type = response->type;
         }
-    } else { // Fix this
-        /* handle responses */
-        if (message->type == COAP_TYPE_CON) {
-            erbium_status_code = EMPTY_ACK_RESPONSE;
-        } else if (message->type == COAP_TYPE_ACK) {
-            /* transactions are closed through lookup below */
-        } else if (message->type == COAP_TYPE_RST) {
+    } else {
+        if (!oc_endpoint_use_tcp(&endpoint)) {
+            /* handle responses */
+            if (message->type == COAP_TYPE_CON) {
+                erbium_status_code = EMPTY_ACK_RESPONSE;
+            } else if (message->type == COAP_TYPE_ACK) {
+                /* transactions are closed through lookup below */
+            } else if (message->type == COAP_TYPE_RST) {
 #ifdef OC_SERVER
-            /* cancel possible subscriptions */
-            coap_remove_observer_by_mid(OC_MBUF_ENDPOINT(m), message->mid);
+                /* cancel possible subscriptions */

Review comment:
       I think it is correct.  The `#ifdef` just makes it look confusing.
   
   ```
           if (!oc_endpoint_use_tcp(&endpoint)) {
               /* handle responses */
               if (message->type == COAP_TYPE_CON) {
                   erbium_status_code = EMPTY_ACK_RESPONSE;
               } else if (message->type == COAP_TYPE_ACK) {
                   /* transactions are closed through lookup below */
               } else if (message->type == COAP_TYPE_RST) {
   #ifdef OC_SERVER
                   /* cancel possible subscriptions */
                   coap_remove_observer_by_mid(OC_MBUF_ENDPOINT(m), 
message->mid);
   #endif
               }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to