From 064044eeae35fb303320ec111c7c57f70dcaf402 Mon Sep 17 00:00:00 2001 From: goldsimon Date: Wed, 12 Apr 2017 09:12:55 +0200 Subject: [PATCH] sockets: speed up event_callback: don't iterate select_cb_list for NETCONN_EVT_RCVPLUS/SENDPLUS if the socket has been readable/writable before already --- src/api/sockets.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/sockets.c b/src/api/sockets.c index 1181794a..199a9898 100644 --- a/src/api/sockets.c +++ b/src/api/sockets.c @@ -2049,13 +2049,18 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len) /* Set event as required */ switch (evt) { case NETCONN_EVT_RCVPLUS: - sock->rcvevent++; + if (sock->rcvevent++ > 0) { + goto no_select_wakeup; + } break; case NETCONN_EVT_RCVMINUS: sock->rcvevent--; goto no_select_wakeup; break; case NETCONN_EVT_SENDPLUS: + if (sock->sendevent) { + goto no_select_wakeup; + } sock->sendevent = 1; break; case NETCONN_EVT_SENDMINUS: