sockets.c, api.h, api_lib.c, api_msg.h, api_msg.c: Fixed bug #20900. Now, most of the netconn_peer and netconn_addr processing is done inside tcpip_thread context in do_getaddr.

This commit is contained in:
fbernon
2007-11-12 22:39:24 +00:00
parent 8020ba2dc5
commit a4d14722f3
6 changed files with 95 additions and 97 deletions

View File

@@ -967,8 +967,7 @@ lwip_shutdown(int s, int how)
}
static int
lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen,
err_t (* netconn_addrfunc)(struct netconn *conn, struct ip_addr *addr, u16_t *port))
lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen, u8_t local)
{
struct lwip_socket *sock;
struct sockaddr_in sin;
@@ -983,7 +982,7 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen,
sin.sin_family = AF_INET;
/* get the IP address and port */
netconn_addrfunc(sock->conn, &naddr, &sin.sin_port);
netconn_getaddr(sock->conn, &naddr, &sin.sin_port, local);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_getaddrname(%d, addr=", s));
ip_addr_debug_print(SOCKETS_DEBUG, &naddr);
@@ -1003,13 +1002,13 @@ lwip_getaddrname(int s, struct sockaddr *name, socklen_t *namelen,
int
lwip_getpeername(int s, struct sockaddr *name, socklen_t *namelen)
{
return lwip_getaddrname(s, name, namelen, netconn_peer);
return lwip_getaddrname(s, name, namelen, 0);
}
int
lwip_getsockname(int s, struct sockaddr *name, socklen_t *namelen)
{
return lwip_getaddrname(s, name, namelen, netconn_addr);
return lwip_getaddrname(s, name, namelen, 1);
}
int