You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ma...@apache.org on 2016/11/22 01:17:14 UTC

[15/27] incubator-mynewt-core git commit: oic; remove coap_engine pseudo-process.

oic; remove coap_engine pseudo-process.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/91419fda
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/91419fda
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/91419fda

Branch: refs/heads/develop
Commit: 91419fdaa1b49a632e07276f85864b5737cacb70
Parents: 948b380
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Thu Nov 17 10:34:36 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Mon Nov 21 17:15:48 2016 -0800

----------------------------------------------------------------------
 net/oic/src/api/oc_buffer.c         |  8 +++++---
 net/oic/src/api/oc_ri.c             |  4 +---
 net/oic/src/messaging/coap/engine.c | 25 ++++---------------------
 net/oic/src/messaging/coap/engine.h |  3 +--
 4 files changed, 11 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/91419fda/net/oic/src/api/oc_buffer.c
----------------------------------------------------------------------
diff --git a/net/oic/src/api/oc_buffer.c b/net/oic/src/api/oc_buffer.c
index e623221..4661529 100644
--- a/net/oic/src/api/oc_buffer.c
+++ b/net/oic/src/api/oc_buffer.c
@@ -96,12 +96,14 @@ OC_PROCESS_THREAD(message_buffer_handler, ev, data)
         LOG("Inbound network event: encrypted request\n");
         oc_process_post(&oc_dtls_handler, oc_events[UDP_TO_DTLS_EVENT], data);
       } else {
-        LOG("Inbound network event: decrypted request\n");
-        oc_process_post(&coap_engine, oc_events[INBOUND_RI_EVENT], data);
+          LOG("Inbound network event: decrypted request\n");
+          coap_receive(data);
+          oc_message_unref(data);
       }
 #else
       LOG("Inbound network event: decrypted request\n");
-      oc_process_post(&coap_engine, oc_events[INBOUND_RI_EVENT], data);
+      coap_receive(data);
+      oc_message_unref(data);
 #endif
     } else if (ev == oc_events[OUTBOUND_NETWORK_EVENT]) {
       oc_message_t *message = (oc_message_t *)data;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/91419fda/net/oic/src/api/oc_ri.c
----------------------------------------------------------------------
diff --git a/net/oic/src/api/oc_ri.c b/net/oic/src/api/oc_ri.c
index 32d9a62..c3c2772 100644
--- a/net/oic/src/api/oc_ri.c
+++ b/net/oic/src/api/oc_ri.c
@@ -192,7 +192,7 @@ static void
 start_processes(void)
 {
   allocate_events();
-  oc_process_start(&coap_engine, NULL);
+  coap_engine_init();
   oc_process_start(&message_buffer_handler, NULL);
 
 #ifdef OC_SECURITY
@@ -205,8 +205,6 @@ start_processes(void)
 static void
 stop_processes(void)
 {
-  oc_process_exit(&coap_engine);
-
 #ifdef OC_SECURITY
   oc_process_exit(&oc_dtls_handler);
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/91419fda/net/oic/src/messaging/coap/engine.c
----------------------------------------------------------------------
diff --git a/net/oic/src/messaging/coap/engine.c b/net/oic/src/messaging/coap/engine.c
index 9d8efaa..3fa4d21 100644
--- a/net/oic/src/messaging/coap/engine.c
+++ b/net/oic/src/messaging/coap/engine.c
@@ -45,8 +45,6 @@
 #include "oc_client_state.h"
 #endif
 
-OC_PROCESS(coap_engine, "CoAP Engine");
-
 extern bool oc_ri_invoke_coap_entity_handler(void *request, void *response,
                                              uint8_t *buffer,
                                              uint16_t buffer_size,
@@ -301,24 +299,9 @@ coap_receive(oc_message_t *msg)
   /* if(new data) */
   return erbium_status_code;
 }
-/*---------------------------------------------------------------------------*/
-OC_PROCESS_THREAD(coap_engine, ev, data)
-{
-  OC_PROCESS_BEGIN();
-
-  coap_init_connection();
-
-  while (1) {
-    OC_PROCESS_YIELD();
-
-    if (ev == oc_events[INBOUND_RI_EVENT]) {
-      coap_receive(data);
 
-      oc_message_unref(data);
-    }
-  }
-
-  OC_PROCESS_END();
+void
+coap_engine_init(void)
+{
+    coap_init_connection();
 }
-
-/*---------------------------------------------------------------------------*/

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/91419fda/net/oic/src/messaging/coap/engine.h
----------------------------------------------------------------------
diff --git a/net/oic/src/messaging/coap/engine.h b/net/oic/src/messaging/coap/engine.h
index 067c1d7..a30793f 100644
--- a/net/oic/src/messaging/coap/engine.h
+++ b/net/oic/src/messaging/coap/engine.h
@@ -43,8 +43,7 @@
 extern "C" {
 #endif
 
-OC_PROCESS_NAME(coap_engine);
-
+void coap_engine_init(void);
 int coap_receive(oc_message_t *message);
 
 #ifdef __cplusplus