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

[1/3] incubator-mynewt-core git commit: obsolete defs

Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop e5083dc4a -> 4e6fdea08


obsolete defs


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/702ad3b9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/702ad3b9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/702ad3b9

Branch: refs/heads/develop
Commit: 702ad3b9511b619b8321b3ddab87f890c879b4ab
Parents: e5083dc
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Nov 1 11:21:41 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Nov 1 11:21:41 2016 -0700

----------------------------------------------------------------------
 kernel/os/include/os/os_eventq.h  | 5 -----
 mgmt/oicmgr/src/oicmgr.c          | 5 -----
 mgmt/oicmgr/syscfg.yml            | 6 ------
 net/nimble/host/src/ble_hs_priv.h | 5 -----
 net/oic/syscfg.yml                | 7 -------
 sys/shell/src/shell.c             | 1 -
 6 files changed, 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/kernel/os/include/os/os_eventq.h
----------------------------------------------------------------------
diff --git a/kernel/os/include/os/os_eventq.h b/kernel/os/include/os/os_eventq.h
index c9ae3e2..87b93ea 100644
--- a/kernel/os/include/os/os_eventq.h
+++ b/kernel/os/include/os/os_eventq.h
@@ -40,11 +40,6 @@ struct os_event {
 
 #define OS_EVENT_QUEUED(__ev) ((__ev)->ev_queued)
 
-#define OS_EVENT_T_TIMER        (1)
-#define OS_EVENT_T_MQUEUE_DATA  (2)
-#define OS_EVENT_T_CB           (3)
-#define OS_EVENT_T_PERUSER      (16)
-
 struct os_eventq {
     struct os_task *evq_task;
     STAILQ_HEAD(, os_event) evq_list;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/mgmt/oicmgr/src/oicmgr.c
----------------------------------------------------------------------
diff --git a/mgmt/oicmgr/src/oicmgr.c b/mgmt/oicmgr/src/oicmgr.c
index 63b7419..ebd7266 100644
--- a/mgmt/oicmgr/src/oicmgr.c
+++ b/mgmt/oicmgr/src/oicmgr.c
@@ -35,11 +35,6 @@
 #include <tinycbor/cbor_buf_reader.h>
 #include <oic/oc_api.h>
 
-#define OMGR_OC_EVENT	(OS_EVENT_T_PERUSER)
-#define OMGR_OC_TIMER	(OS_EVENT_T_PERUSER + 1)
-#define OMGR_OC_START	(OS_EVENT_T_PERUSER + 2)
-#define OICMGR_STACK_SZ	OS_STACK_ALIGN(MYNEWT_VAL(OICMGR_STACK_SIZE))
-
 struct omgr_cbuf {
     struct mgmt_cbuf ob_mj;
     struct cbor_buf_reader ob_reader;

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/mgmt/oicmgr/syscfg.yml
----------------------------------------------------------------------
diff --git a/mgmt/oicmgr/syscfg.yml b/mgmt/oicmgr/syscfg.yml
index eca2da7..01c2e77 100644
--- a/mgmt/oicmgr/syscfg.yml
+++ b/mgmt/oicmgr/syscfg.yml
@@ -17,9 +17,3 @@
 # under the License.
 #
 syscfg.defs:
-    OICMGR_TASK_PRIO:
-        type: 'task_priority'
-        value: 'any'
-    OICMGR_STACK_SIZE:
-        value: 512
-

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/net/nimble/host/src/ble_hs_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_hs_priv.h b/net/nimble/host/src/ble_hs_priv.h
index 1aa4d5d..3ac8388 100644
--- a/net/nimble/host/src/ble_hs_priv.h
+++ b/net/nimble/host/src/ble_hs_priv.h
@@ -54,11 +54,6 @@ struct os_mbuf;
 struct os_mempool;
 struct os_event;
 
-#define BLE_HOST_HCI_EVENT_CTLR_EVENT   (OS_EVENT_T_PERUSER + 0)
-#define BLE_HS_EVENT_TX_NOTIFICATIONS   (OS_EVENT_T_PERUSER + 1)
-#define BLE_HS_EVENT_RESET              (OS_EVENT_T_PERUSER + 2)
-#define BLE_HS_EVENT_START              (OS_EVENT_T_PERUSER + 3)
-
 #define BLE_HS_SYNC_STATE_BAD           0
 #define BLE_HS_SYNC_STATE_BRINGUP       1
 #define BLE_HS_SYNC_STATE_GOOD          2

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/net/oic/syscfg.yml
----------------------------------------------------------------------
diff --git a/net/oic/syscfg.yml b/net/oic/syscfg.yml
index f3741ff..47e9802 100644
--- a/net/oic/syscfg.yml
+++ b/net/oic/syscfg.yml
@@ -38,13 +38,6 @@ syscfg.defs:
     OC_DEBUG:
         description: 'Enables OIC debug logs'
         value: '0'
-    OC_TASK_PRIORITY:
-        description: 'The task priority for an internal tasks that runs the OCF stack'
-        value: '4'
-    OC_TASK_STACK_SIZE:
-        description: 'The stack size of the OC task in words'
-        value: '300'
-
     OC_NUM_REP_OBJECTS:
         description: 'Estimated number of nodes in payload tree structure'
         value: 32

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/702ad3b9/sys/shell/src/shell.c
----------------------------------------------------------------------
diff --git a/sys/shell/src/shell.c b/sys/shell/src/shell.c
index 7482f9b..2f04520 100644
--- a/sys/shell/src/shell.c
+++ b/sys/shell/src/shell.c
@@ -37,7 +37,6 @@ static void *g_shell_nlip_in_arg;
 
 static struct os_mqueue g_shell_nlip_mq;
 
-#define OS_EVENT_T_CONSOLE_RDY  (OS_EVENT_T_PERUSER)
 #define SHELL_HELP_PER_LINE     6
 #define SHELL_MAX_ARGS          20
 


[3/3] incubator-mynewt-core git commit: oic - Fix some build errors on linux.

Posted by cc...@apache.org.
oic - Fix some build errors on linux.


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/4e6fdea0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4e6fdea0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4e6fdea0

Branch: refs/heads/develop
Commit: 4e6fdea080ce3472a7af4af4e988807ee40bcc4c
Parents: d1259ed
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Nov 1 12:02:25 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Nov 1 12:02:25 2016 -0700

----------------------------------------------------------------------
 net/oic/src/port/mynewt/abort.c       |  8 +++++++-
 net/oic/src/port/mynewt/ble_adaptor.c |  2 +-
 net/oic/src/port/mynewt/ip_adaptor.c  | 12 +++++++-----
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e6fdea0/net/oic/src/port/mynewt/abort.c
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/abort.c b/net/oic/src/port/mynewt/abort.c
index e7be3ad..49bcf63 100644
--- a/net/oic/src/port/mynewt/abort.c
+++ b/net/oic/src/port/mynewt/abort.c
@@ -20,6 +20,12 @@
 #include "../oc_assert.h"
 #include <assert.h>
 
-void abort_impl(void) {
+#ifndef abort_impl
+
+void
+abort_impl(void)
+{
     assert(0);
 }
+
+#endif

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e6fdea0/net/oic/src/port/mynewt/ble_adaptor.c
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/ble_adaptor.c b/net/oic/src/port/mynewt/ble_adaptor.c
index e4e0e0f..6963249 100644
--- a/net/oic/src/port/mynewt/ble_adaptor.c
+++ b/net/oic/src/port/mynewt/ble_adaptor.c
@@ -166,7 +166,7 @@ oc_attempt_rx_gatt(void)
     message->endpoint.flags = GATT;
     message->endpoint.bt_addr.conn_handle = conn_handle;
     message->length = pkt->omp_len;
-    LOG("Successfully rx length %lu\n", message->length);
+    LOG("Successfully rx length %lu\n", (unsigned long)message->length);
     return message;
 
     /* add the addr info to the message */

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e6fdea0/net/oic/src/port/mynewt/ip_adaptor.c
----------------------------------------------------------------------
diff --git a/net/oic/src/port/mynewt/ip_adaptor.c b/net/oic/src/port/mynewt/ip_adaptor.c
index e05f606..646a5b0 100644
--- a/net/oic/src/port/mynewt/ip_adaptor.c
+++ b/net/oic/src/port/mynewt/ip_adaptor.c
@@ -64,7 +64,8 @@ oc_send_buffer_ip_int(oc_message_t *message, int mcast)
     struct os_mbuf m;
     int rc;
 
-    LOG("oc_transport_ip attempt send buffer %lu\n", message->length);
+    LOG("oc_transport_ip attempt send buffer %lu\n",
+        (unsigned long)message->length);
 
     to.msin6_len = sizeof(to);
     to.msin6_family = MN_AF_INET6;
@@ -98,14 +99,14 @@ oc_send_buffer_ip_int(oc_message_t *message, int mcast)
             rc = mn_sendto(ucast, &m, (struct mn_sockaddr *) &to);
             if (rc != 0) {
                 ERROR("Failed sending buffer %lu on itf %d\n",
-                      message->length, to.msin6_scope_id);
+                      (unsigned long)message->length, to.msin6_scope_id);
             }
         }
     } else {
         rc = mn_sendto(ucast, &m, (struct mn_sockaddr *) &to);
         if (rc != 0) {
             ERROR("Failed sending buffer %lu on itf %d\n",
-                  message->length, to.msin6_scope_id);
+                  (unsigned long)message->length, to.msin6_scope_id);
         }
     }
     oc_message_unref(message);
@@ -170,7 +171,8 @@ oc_attempt_rx_ip_sock(struct mn_socket * rxsock) {
     message->endpoint.ipv6_addr.scope = from.msin6_scope_id;
     message->endpoint.ipv6_addr.port = ntohs(from.msin6_port);
 
-    LOG("Successfully rx from %p len %lu\n", rxsock, message->length);
+    LOG("Successfully rx from %p len %lu\n", rxsock,
+        (unsigned long)message->length);
     return message;
 
     /* add the addr info to the message */
@@ -208,7 +210,7 @@ union mn_socket_cb oc_sock_cbs = {
 void
 oc_socks_readable(void *cb_arg, int err)
 {
-    os_eventq_put(&oc_evq_get(), &oc_sock_read_event);
+    os_eventq_put(oc_evq_get(), &oc_sock_read_event);
 }
 
 void


[2/3] incubator-mynewt-core git commit: inet_def_service - Remove dedicated task.

Posted by cc...@apache.org.
inet_def_service - Remove dedicated task.


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/d1259edc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d1259edc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d1259edc

Branch: refs/heads/develop
Commit: d1259edc81d50c7b2e818ef701fd08b894ae0c83
Parents: 702ad3b
Author: Christopher Collins <cc...@apache.org>
Authored: Tue Nov 1 12:01:59 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Tue Nov 1 12:01:59 2016 -0700

----------------------------------------------------------------------
 .../include/inet_def_service/inet_def_service.h |   5 +-
 net/ip/inet_def_service/src/inet_def_service.c  | 251 ++++++++++++-------
 2 files changed, 158 insertions(+), 98 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d1259edc/net/ip/inet_def_service/include/inet_def_service/inet_def_service.h
----------------------------------------------------------------------
diff --git a/net/ip/inet_def_service/include/inet_def_service/inet_def_service.h b/net/ip/inet_def_service/include/inet_def_service/inet_def_service.h
index 0f9f6e1..eae144c 100644
--- a/net/ip/inet_def_service/include/inet_def_service/inet_def_service.h
+++ b/net/ip/inet_def_service/include/inet_def_service/inet_def_service.h
@@ -24,7 +24,10 @@
 extern "C" {
 #endif
 
-int inet_def_service_init(uint8_t prio, os_stack_t *stack, uint16_t stack_sz);
+struct os_eventq;
+
+void inet_def_evq_set(struct os_eventq *evq);
+void inet_def_service_init(void);
 
 #ifdef __cplusplus
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d1259edc/net/ip/inet_def_service/src/inet_def_service.c
----------------------------------------------------------------------
diff --git a/net/ip/inet_def_service/src/inet_def_service.c b/net/ip/inet_def_service/src/inet_def_service.c
index 3b2c015..5e082e5 100644
--- a/net/ip/inet_def_service/src/inet_def_service.c
+++ b/net/ip/inet_def_service/src/inet_def_service.c
@@ -44,8 +44,12 @@ enum inet_def_type {
 static const char chargen_pattern[] = "1234567890";
 #define CHARGEN_PATTERN_SZ   (sizeof(chargen_pattern) - 1)
 
-static struct os_task inet_def_task;
-static struct os_eventq inet_def_evq;
+static struct os_eventq *inet_def_evq;
+
+static void inet_def_event_echo(struct os_event *ev);
+static void inet_def_event_discard(struct os_event *ev);
+static void inet_def_event_chargen(struct os_event *ev);
+static void inet_def_event_start(struct os_event *ev);
 
 /*
  * UDP service.
@@ -78,7 +82,35 @@ static struct inet_def {
     struct inet_def_listen tcp_service[INET_DEF_MAXTYPE];
     struct inet_def_udp udp_service[INET_DEF_MAXTYPE];
     SLIST_HEAD(, inet_def_tcp) tcp_conns; /* List of connected TCP sockets */
-} inet_def;
+} inet_def = {
+    .udp_service = {
+        [INET_DEF_ECHO] = {
+            .ev.ev_cb = inet_def_event_echo,
+            .ev.ev_arg = (void *)MN_SOCK_DGRAM,
+        },
+        [INET_DEF_DISCARD] = {
+            .ev.ev_cb = inet_def_event_discard,
+            .ev.ev_arg = (void *)MN_SOCK_DGRAM,
+        },
+        [INET_DEF_CHARGEN] = {
+            .ev.ev_cb = inet_def_event_chargen,
+            .ev.ev_arg = (void *)MN_SOCK_DGRAM,
+        },
+    }
+};
+
+static struct os_eventq *
+inet_def_evq_get(void)
+{
+    os_eventq_ensure(&inet_def_evq, inet_def_event_start);
+    return inet_def_evq;
+}
+
+void
+inet_def_evq_set(struct os_eventq *evq)
+{
+    os_eventq_designate(&inet_def_evq, evq, inet_def_event_start);
+}
 
 /*
  * UDP socket callbacks. Called in context of IP stack task.
@@ -212,122 +244,147 @@ err:
     return -1;
 }
 
-static void
-inet_def_srv(void *arg)
+static struct mn_socket *
+inet_def_socket_from_event(struct os_event *ev,
+                           struct inet_def_udp **out_idu,
+                           struct inet_def_tcp **out_idt)
 {
     struct inet_def_udp *idu;
     struct inet_def_tcp *idt;
     struct mn_socket *sock;
-    struct os_event *ev;
+
+    if ((int)ev->ev_arg == MN_SOCK_DGRAM) {
+        idu = (struct inet_def_udp *)ev;
+        idt = NULL;
+        sock = idu->socket;
+    } else {
+        idt = (struct inet_def_tcp *)ev;
+        idu = NULL;
+        sock = idt->socket;
+    }
+
+    if (out_idu != NULL) {
+        *out_idu = idu;
+    }
+    if (out_idt != NULL) {
+        *out_idt = idt;
+    }
+
+    return sock;
+}
+
+static void
+inet_def_free_closed_tcp_sock(struct inet_def_tcp *idt)
+{
+    if (idt != NULL && idt->closed) {
+        /*
+         * Remote end has closed the connection, as indicated in the
+         * callback. Close the socket and free the memory.
+         */
+        mn_socket_set_cbs(idt->socket, NULL, NULL);
+        os_eventq_remove(inet_def_evq_get(), &idt->ev);
+        mn_close(idt->socket);
+        os_free(idt);
+    }
+}
+
+static void
+inet_def_event_echo(struct os_event *ev)
+{
     struct mn_sockaddr_in msin;
+    struct inet_def_tcp *idt;
+    struct mn_socket *sock;
     struct os_mbuf *m;
-    enum inet_def_type type;
     int rc;
-    int off;
-    int loop_cnt;
 
-    inet_def_create_srv(INET_DEF_ECHO, ECHO_PORT);
-    inet_def_create_srv(INET_DEF_DISCARD, DISCARD_PORT);
-    inet_def_create_srv(INET_DEF_CHARGEN, CHARGEN_PORT);
+    sock = inet_def_socket_from_event(ev, NULL, &idt);
+    while (mn_recvfrom(sock, &m, (struct mn_sockaddr *)&msin) == 0) {
+        console_printf("echo %d bytes\n", OS_MBUF_PKTLEN(m));
+        rc = mn_sendto(sock, m, (struct mn_sockaddr *)&msin);
+        if (rc) {
+            console_printf("  failed: %d!!!!\n", rc);
+            os_mbuf_free_chain(m);
+        }
+    }
+
+    inet_def_free_closed_tcp_sock(idt);
+}
 
-    while (1) {
+static void
+inet_def_event_discard(struct os_event *ev)
+{
+    struct inet_def_tcp *idt;
+    struct mn_socket *sock;
+    struct os_mbuf *m;
+
+    sock = inet_def_socket_from_event(ev, NULL, NULL);
+    while (mn_recvfrom(sock, &m, NULL) == 0) {
+        console_printf("discard %d bytes\n", OS_MBUF_PKTLEN(m));
+        os_mbuf_free_chain(m);
+    }
+
+    inet_def_free_closed_tcp_sock(idt);
+}
+
+static void
+inet_def_event_chargen(struct os_event *ev)
+{
+    struct inet_def_tcp *idt;
+    struct mn_socket *sock;
+    struct os_mbuf *m;
+    int loop_cnt;
+
+    sock = inet_def_socket_from_event(ev, NULL, &idt);
+    while (mn_recvfrom(sock, &m, NULL) == 0) {
+        os_mbuf_free_chain(m);
+    }
+    if (idt == NULL || !idt->closed) {
         /*
-         * Wait here. When event comes, check what type of socket got it,
-         * and then act on it.
+         * Don't try to send tons of data to a closed socket.
          */
-        ev = os_eventq_get(&inet_def_evq);
-        type = INET_DEF_FROM_EVENT_TYPE(ev->ev_type);
-        idt = (struct inet_def_tcp *)ev;
-        idu = (struct inet_def_udp *)ev;
-        if ((int)ev->ev_arg == MN_SOCK_DGRAM) {
-            sock = idu->socket;
-        } else {
-            sock = idt->socket;
-        }
-        switch (type) {
-        case INET_DEF_ECHO:
-            while (mn_recvfrom(sock, &m, (struct mn_sockaddr *)&msin) == 0) {
-                console_printf("echo %d bytes\n", OS_MBUF_PKTLEN(m));
-                rc = mn_sendto(sock, m, (struct mn_sockaddr *)&msin);
+        loop_cnt = 0;
+        do {
+            m = os_msys_get(CHARGEN_WRITE_SZ, 0);
+            if (m) {
+                for (off = 0;
+                     OS_MBUF_TRAILINGSPACE(m) >= CHARGEN_PATTERN_SZ;
+                     off += CHARGEN_PATTERN_SZ) {
+                    os_mbuf_copyinto(m, off, chargen_pattern,
+                      CHARGEN_PATTERN_SZ);
+                }
+                console_printf("chargen %d bytes\n", m->om_len);
+                rc = mn_sendto(sock, m, NULL); /* assumes TCP for now */
                 if (rc) {
-                    console_printf("  failed: %d!!!!\n", rc);
                     os_mbuf_free_chain(m);
+                    if (rc != MN_ENOBUFS && rc != MN_EAGAIN) {
+                        console_write("  sendto fail!!! %d\n", rc);
+                    }
+                    break;
                 }
-            }
-            break;
-        case INET_DEF_DISCARD:
-            while (mn_recvfrom(sock, &m, NULL) == 0) {
-                console_printf("discard %d bytes\n", OS_MBUF_PKTLEN(m));
-                os_mbuf_free_chain(m);
-            }
-            break;
-        case INET_DEF_CHARGEN:
-            while (mn_recvfrom(sock, &m, NULL) == 0) {
-                os_mbuf_free_chain(m);
-            }
-            if ((int)ev->ev_arg == MN_SOCK_STREAM && idt->closed) {
+            } else {
                 /*
-                 * Don't try to send tons of data to a closed socket.
+                 * Mbuf shortage. Wait for them to appear.
                  */
-                break;
+                os_time_delay(1);
             }
-            loop_cnt = 0;
-            do {
-                m = os_msys_get(CHARGEN_WRITE_SZ, 0);
-                if (m) {
-                    for (off = 0;
-                         OS_MBUF_TRAILINGSPACE(m) >= CHARGEN_PATTERN_SZ;
-                         off += CHARGEN_PATTERN_SZ) {
-                        os_mbuf_copyinto(m, off, chargen_pattern,
-                          CHARGEN_PATTERN_SZ);
-                    }
-                    console_printf("chargen %d bytes\n", m->om_len);
-                    rc = mn_sendto(sock, m, NULL); /* assumes TCP for now */
-                    if (rc) {
-                        os_mbuf_free_chain(m);
-                        if (rc != MN_ENOBUFS && rc != MN_EAGAIN) {
-                            console_write("  sendto fail!!! %d\n", rc);
-                        }
-                        break;
-                    }
-                } else {
-                    /*
-                     * Mbuf shortage. Wait for them to appear.
-                     */
-                    os_time_delay(1);
-                }
-                loop_cnt++;
-            } while (loop_cnt < 32);
-            break;
-        default:
-            assert(0);
-            break;
-        }
-        if ((int)ev->ev_arg == MN_SOCK_STREAM && idt->closed) {
-            /*
-             * Remote end has closed the connection, as indicated in the
-             * callback. Close the socket and free the memory.
-             */
-            mn_socket_set_cbs(idt->socket, NULL, NULL);
-            os_eventq_remove(&inet_def_evq, &idt->ev);
-            mn_close(idt->socket);
-            os_free(idt);
-        }
+            loop_cnt++;
+        } while (loop_cnt < 32);
     }
+
+    inet_def_free_closed_tcp_sock(idt);
 }
 
-int
-inet_def_service_init(uint8_t prio, os_stack_t *stack, uint16_t stack_sz)
+static void
+inet_def_event_start(struct os_event *ev)
 {
-    int i;
+    inet_def_create_srv(INET_DEF_ECHO, ECHO_PORT);
+    inet_def_create_srv(INET_DEF_DISCARD, DISCARD_PORT);
+    inet_def_create_srv(INET_DEF_CHARGEN, CHARGEN_PORT);
+}
 
-    os_eventq_init(&inet_def_evq);
+void
+inet_def_service_init(void)
+{
     SLIST_INIT(&inet_def.tcp_conns);
-    for (i = 0; i < 3; i++) {
-        inet_def.udp_service[i].ev.ev_type = INET_EVENT_TYPE_FROM_DEF(i);
-        inet_def.udp_service[i].ev.ev_arg = (void *)MN_SOCK_DGRAM;
-    }
-    return os_task_init(&inet_def_task, "inet_def_task",
-      inet_def_srv, NULL, prio, OS_WAIT_FOREVER, stack, stack_sz);
 }