Imported Upstream version 1.2.0
[platform/upstream/iotivity.git] / extlibs / tinydtls / session.c
index 9acf565..6170fd1 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "dtls_config.h"
+#include "debug.h"
 #include "session.h"
 
 #ifdef HAVE_ASSERT_H
 
 #else /* WITH_CONTIKI */
 
-static inline int 
+INLINE_API int 
 _dtls_address_equals_impl(const session_t *a,
                          const session_t *b) {
+  if ((a == b) && (a != NULL))
+    return 1;
   if (a->ifindex != b->ifindex ||
       a->size != b->size || a->addr.sa.sa_family != b->addr.sa.sa_family)
     return 0;
@@ -63,7 +66,7 @@ _dtls_address_equals_impl(const session_t *a,
      memcmp(&a->addr.sin6.sin6_addr, &b->addr.sin6.sin6_addr, 
            sizeof(struct in6_addr)) == 0;
  default: /* fall through and signal error */
-   ;
+    dtls_emerg("Could not compare dtls addresses!\n");
  }
  return 0;
 }