mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +00:00
* sockets.h, sockets.c: Move socket initialization to new
lwip_socket_init() function.
This commit is contained in:
parent
de665f7cf9
commit
1d22294974
@ -27,6 +27,12 @@ HISTORY
|
|||||||
|
|
||||||
++ New features:
|
++ New features:
|
||||||
|
|
||||||
|
2007-02-26 Jonathan Larmour (based on patch from Simon Goldschmidt)
|
||||||
|
* sockets.h, sockets.c: Move socket initialization to new
|
||||||
|
lwip_socket_init() function.
|
||||||
|
NOTE: this changes the API with ports. Ports will have to be
|
||||||
|
updated to call lwip_socket_init() now.
|
||||||
|
|
||||||
2007-02-26 Jonathan Larmour (based on patch from Simon Goldschmidt)
|
2007-02-26 Jonathan Larmour (based on patch from Simon Goldschmidt)
|
||||||
* api_lib.c: Use memcpy in netbuf_copy_partial.
|
* api_lib.c: Use memcpy in netbuf_copy_partial.
|
||||||
|
|
||||||
|
@ -106,6 +106,13 @@ static int err_to_errno_table[11] = {
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
lwip_socket_init(void)
|
||||||
|
{
|
||||||
|
socksem = sys_sem_new(1);
|
||||||
|
selectsem = sys_sem_new(1);
|
||||||
|
}
|
||||||
|
|
||||||
static struct lwip_socket *
|
static struct lwip_socket *
|
||||||
get_socket(int s)
|
get_socket(int s)
|
||||||
{
|
{
|
||||||
@ -133,9 +140,6 @@ alloc_socket(struct netconn *newconn)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!socksem)
|
|
||||||
socksem = sys_sem_new(1);
|
|
||||||
|
|
||||||
/* Protect socket array */
|
/* Protect socket array */
|
||||||
sys_sem_wait(socksem);
|
sys_sem_wait(socksem);
|
||||||
|
|
||||||
@ -252,8 +256,6 @@ lwip_close(int s)
|
|||||||
struct lwip_socket *sock;
|
struct lwip_socket *sock;
|
||||||
|
|
||||||
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
|
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_close(%d)\n", s));
|
||||||
if (!socksem)
|
|
||||||
socksem = sys_sem_new(1);
|
|
||||||
|
|
||||||
/* We cannot allow multiple closes of the same socket. */
|
/* We cannot allow multiple closes of the same socket. */
|
||||||
sys_sem_wait(socksem);
|
sys_sem_wait(socksem);
|
||||||
@ -675,8 +677,6 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
|
|||||||
select_cb.sem_signalled = 0;
|
select_cb.sem_signalled = 0;
|
||||||
|
|
||||||
/* Protect ourselves searching through the list */
|
/* Protect ourselves searching through the list */
|
||||||
if (!selectsem)
|
|
||||||
selectsem = sys_sem_new(1);
|
|
||||||
sys_sem_wait(selectsem);
|
sys_sem_wait(selectsem);
|
||||||
|
|
||||||
if (readset)
|
if (readset)
|
||||||
@ -831,9 +831,6 @@ event_callback(struct netconn *conn, enum netconn_evt evt, u16_t len)
|
|||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!selectsem)
|
|
||||||
selectsem = sys_sem_new(1);
|
|
||||||
|
|
||||||
sys_sem_wait(selectsem);
|
sys_sem_wait(selectsem);
|
||||||
/* Set event as required */
|
/* Set event as required */
|
||||||
switch (evt)
|
switch (evt)
|
||||||
|
@ -222,6 +222,7 @@ struct linger {
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void lwip_socket_init(void);
|
||||||
int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
|
||||||
int lwip_bind(int s, struct sockaddr *name, socklen_t namelen);
|
int lwip_bind(int s, struct sockaddr *name, socklen_t namelen);
|
||||||
int lwip_shutdown(int s, int how);
|
int lwip_shutdown(int s, int how);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user