diff --git a/CHANGELOG b/CHANGELOG index 1b792f26..8dd3391f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,10 @@ FUTURE (sizeof(int)). In ppp.c an assumption is made on the availability of a thread subsystem. Either PPP needs to be moved to contrib/ports/??? or rearranged to be more generic. + + * TODO: review the the sequential netconn and socket API (lwip/src/api) + for bugs and performance issues. Frequent system calls (e.g. sys_mbox_fetch) + slooow things down considerably. HISTORY @@ -21,6 +25,10 @@ HISTORY * [Enter new changes just after this line - do not remove this line] + 2006-05-26 Christiaan Simons + * api_lib.c: Removed conn->sem creation and destruction + from netconn_write() and added sys_sem_new to netconn_new_*. + 2006-03-29 Christiaan Simons * inet.c, inet.h: Added platform byteswap support. Added LWIP_PLATFORM_BYTESWAP define (defaults to 0) and diff --git a/src/api/api_lib.c b/src/api/api_lib.c index 3d83d1ea..e5da5dd4 100644 --- a/src/api/api_lib.c +++ b/src/api/api_lib.c @@ -215,7 +215,11 @@ netconn *netconn_new_with_proto_and_callback(enum netconn_type t, u16_t proto, } conn->recvmbox = SYS_MBOX_NULL; conn->acceptmbox = SYS_MBOX_NULL; - conn->sem = SYS_SEM_NULL; + conn->sem = sys_sem_new(0); + if (conn->sem == SYS_SEM_NULL) { + memp_free(MEMP_NETCONN, conn); + return NULL; + } conn->state = NETCONN_NONE; conn->socket = 0; conn->callback = callback; @@ -630,13 +634,6 @@ netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy) if (conn->err != ERR_OK) { return conn->err; } - - if (conn->sem == SYS_SEM_NULL) { - conn->sem = sys_sem_new(0); - if (conn->sem == SYS_SEM_NULL) { - return ERR_MEM; - } - } if ((msg = memp_malloc(MEMP_API_MSG)) == NULL) { return (conn->err = ERR_MEM); @@ -685,10 +682,6 @@ netconn_write(struct netconn *conn, void *dataptr, u16_t size, u8_t copy) ret: memp_free(MEMP_API_MSG, msg); conn->state = NETCONN_NONE; - if (conn->sem != SYS_SEM_NULL) { - sys_sem_free(conn->sem); - conn->sem = SYS_SEM_NULL; - } return conn->err; }