Removed conn->sem creation and destruction from netconn_write() and added sys_sem_new to netconn_new_*

This commit is contained in:
christiaans 2006-05-26 07:39:39 +00:00
parent 6158aa684b
commit 7026bbcdd4
2 changed files with 13 additions and 12 deletions

View File

@ -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

View File

@ -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;
}