mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-05 22:29:49 +00:00
Minor Fix (unsed code, spaces, idents..)
This commit is contained in:
parent
6bfa99a774
commit
d5e37309e5
@ -84,11 +84,12 @@ recv_udp(void *arg, struct udp_pcb *pcb, struct pbuf *p,
|
|||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = arg;
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
pbuf_free(p);
|
pbuf_free(p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conn->recvmbox != SYS_MBOX_NULL) {
|
if (conn->recvmbox != SYS_MBOX_NULL) {
|
||||||
buf = memp_malloc(MEMP_NETBUF);
|
buf = memp_malloc(MEMP_NETBUF);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
@ -117,9 +118,9 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
{
|
{
|
||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
u16_t len;
|
u16_t len;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = arg;
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
@ -128,7 +129,6 @@ recv_tcp(void *arg, struct tcp_pcb *pcb, struct pbuf *p, err_t err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conn->recvmbox != SYS_MBOX_NULL) {
|
if (conn->recvmbox != SYS_MBOX_NULL) {
|
||||||
|
|
||||||
conn->err = err;
|
conn->err = err;
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
len = p->tot_len;
|
len = p->tot_len;
|
||||||
@ -151,7 +151,7 @@ poll_tcp(void *arg, struct tcp_pcb *pcb)
|
|||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = arg;
|
||||||
|
|
||||||
if (conn != NULL &&
|
if (conn != NULL &&
|
||||||
@ -168,7 +168,7 @@ sent_tcp(void *arg, struct tcp_pcb *pcb, u16_t len)
|
|||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = arg;
|
||||||
|
|
||||||
if (conn != NULL && conn->sem != SYS_SEM_NULL) {
|
if (conn != NULL && conn->sem != SYS_SEM_NULL) {
|
||||||
@ -217,7 +217,7 @@ static void
|
|||||||
setup_tcp(struct netconn *conn)
|
setup_tcp(struct netconn *conn)
|
||||||
{
|
{
|
||||||
struct tcp_pcb *pcb;
|
struct tcp_pcb *pcb;
|
||||||
|
|
||||||
pcb = conn->pcb.tcp;
|
pcb = conn->pcb.tcp;
|
||||||
tcp_arg(pcb, conn);
|
tcp_arg(pcb, conn);
|
||||||
tcp_recv(pcb, recv_tcp);
|
tcp_recv(pcb, recv_tcp);
|
||||||
@ -231,7 +231,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
|||||||
{
|
{
|
||||||
struct netconn *newconn;
|
struct netconn *newconn;
|
||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
|
|
||||||
#if API_MSG_DEBUG
|
#if API_MSG_DEBUG
|
||||||
#if TCP_DEBUG
|
#if TCP_DEBUG
|
||||||
tcp_debug_print_state(newpcb->state);
|
tcp_debug_print_state(newpcb->state);
|
||||||
@ -278,7 +278,7 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
|||||||
#if LWIP_SO_RCVTIMEO
|
#if LWIP_SO_RCVTIMEO
|
||||||
newconn->recv_timeout = 0;
|
newconn->recv_timeout = 0;
|
||||||
#endif /* LWIP_SO_RCVTIMEO */
|
#endif /* LWIP_SO_RCVTIMEO */
|
||||||
|
|
||||||
sys_mbox_post( conn->acceptmbox, newconn);
|
sys_mbox_post( conn->acceptmbox, newconn);
|
||||||
return ERR_OK;
|
return ERR_OK;
|
||||||
}
|
}
|
||||||
@ -340,7 +340,7 @@ pcb_new(struct api_msg_msg *msg)
|
|||||||
break;
|
break;
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
}
|
}
|
||||||
|
|
||||||
return msg->conn->err;
|
return msg->conn->err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,9 +369,7 @@ do_delconn(struct api_msg_msg *msg)
|
|||||||
#endif /* LWIP_RAW */
|
#endif /* LWIP_RAW */
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
msg->conn->pcb.udp->recv_arg = NULL;
|
msg->conn->pcb.udp->recv_arg = NULL;
|
||||||
udp_remove(msg->conn->pcb.udp);
|
udp_remove(msg->conn->pcb.udp);
|
||||||
@ -403,7 +401,7 @@ do_delconn(struct api_msg_msg *msg)
|
|||||||
(*msg->conn->callback)(msg->conn, NETCONN_EVT_RCVPLUS, 0);
|
(*msg->conn->callback)(msg->conn, NETCONN_EVT_RCVPLUS, 0);
|
||||||
(*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDPLUS, 0);
|
(*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDPLUS, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg->conn->mbox != SYS_MBOX_NULL) {
|
if (msg->conn->mbox != SYS_MBOX_NULL) {
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
@ -425,9 +423,7 @@ do_bind(struct api_msg_msg *msg)
|
|||||||
#endif /* LWIP_RAW */
|
#endif /* LWIP_RAW */
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
msg->conn->err = udp_bind(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
msg->conn->err = udp_bind(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
||||||
break;
|
break;
|
||||||
@ -450,13 +446,13 @@ do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
|
|||||||
struct netconn *conn;
|
struct netconn *conn;
|
||||||
|
|
||||||
LWIP_UNUSED_ARG(pcb);
|
LWIP_UNUSED_ARG(pcb);
|
||||||
|
|
||||||
conn = arg;
|
conn = arg;
|
||||||
|
|
||||||
if (conn == NULL) {
|
if (conn == NULL) {
|
||||||
return ERR_VAL;
|
return ERR_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn->err = err;
|
conn->err = err;
|
||||||
if (conn->type == NETCONN_TCP && err == ERR_OK) {
|
if (conn->type == NETCONN_TCP && err == ERR_OK) {
|
||||||
setup_tcp(conn);
|
setup_tcp(conn);
|
||||||
@ -486,9 +482,7 @@ do_connect(struct api_msg_msg *msg)
|
|||||||
#endif /* LWIP_RAW */
|
#endif /* LWIP_RAW */
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
udp_connect(msg->conn->pcb.udp, msg->msg.bc.ipaddr, msg->msg.bc.port);
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
@ -511,22 +505,13 @@ void
|
|||||||
do_disconnect(struct api_msg_msg *msg)
|
do_disconnect(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
switch (msg->conn->type) {
|
switch (msg->conn->type) {
|
||||||
#if LWIP_RAW
|
|
||||||
case NETCONN_RAW:
|
|
||||||
/* Do nothing as connecting is only a helper for upper lwip layers */
|
|
||||||
break;
|
|
||||||
#endif /* LWIP_RAW */
|
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
udp_disconnect(msg->conn->pcb.udp);
|
udp_disconnect(msg->conn->pcb.udp);
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
case NETCONN_TCP:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
@ -537,20 +522,6 @@ do_listen(struct api_msg_msg *msg)
|
|||||||
{
|
{
|
||||||
if (msg->conn->pcb.tcp != NULL) {
|
if (msg->conn->pcb.tcp != NULL) {
|
||||||
switch (msg->conn->type) {
|
switch (msg->conn->type) {
|
||||||
#if LWIP_RAW
|
|
||||||
case NETCONN_RAW:
|
|
||||||
LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: listen RAW: cannot listen for RAW.\n"));
|
|
||||||
break;
|
|
||||||
#endif /* LWIP_RAW */
|
|
||||||
#if LWIP_UDP
|
|
||||||
case NETCONN_UDPLITE:
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
|
||||||
LWIP_DEBUGF(API_MSG_DEBUG, ("api_msg: listen UDP: cannot listen for UDP.\n"));
|
|
||||||
break;
|
|
||||||
#endif /* LWIP_UDP */
|
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
case NETCONN_TCP:
|
case NETCONN_TCP:
|
||||||
msg->conn->pcb.tcp = tcp_listen(msg->conn->pcb.tcp);
|
msg->conn->pcb.tcp = tcp_listen(msg->conn->pcb.tcp);
|
||||||
@ -567,8 +538,6 @@ do_listen(struct api_msg_msg *msg)
|
|||||||
tcp_accept(msg->conn->pcb.tcp, accept_function);
|
tcp_accept(msg->conn->pcb.tcp, accept_function);
|
||||||
}
|
}
|
||||||
#endif /* LWIP_TCP */
|
#endif /* LWIP_TCP */
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
@ -577,7 +546,6 @@ do_listen(struct api_msg_msg *msg)
|
|||||||
void
|
void
|
||||||
do_send(struct api_msg_msg *msg)
|
do_send(struct api_msg_msg *msg)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (msg->conn->err==ERR_OK) {
|
if (msg->conn->err==ERR_OK) {
|
||||||
if (msg->conn->pcb.tcp != NULL) {
|
if (msg->conn->pcb.tcp != NULL) {
|
||||||
switch (msg->conn->type) {
|
switch (msg->conn->type) {
|
||||||
@ -592,9 +560,7 @@ do_send(struct api_msg_msg *msg)
|
|||||||
#endif
|
#endif
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
if (msg->msg.b->addr==NULL) {
|
if (msg->msg.b->addr==NULL) {
|
||||||
msg->conn->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
|
msg->conn->err = udp_send(msg->conn->pcb.udp, msg->msg.b->p);
|
||||||
@ -603,8 +569,6 @@ do_send(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
case NETCONN_TCP:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -620,7 +584,7 @@ do_recv(struct api_msg_msg *msg)
|
|||||||
tcp_recved(msg->conn->pcb.tcp, msg->msg.len);
|
tcp_recved(msg->conn->pcb.tcp, msg->msg.len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* LWIP_TCP */
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -629,7 +593,7 @@ do_write(struct api_msg_msg *msg)
|
|||||||
{
|
{
|
||||||
#if LWIP_TCP
|
#if LWIP_TCP
|
||||||
err_t err;
|
err_t err;
|
||||||
#endif
|
#endif /* LWIP_TCP */
|
||||||
if (msg->conn->err==ERR_OK) {
|
if (msg->conn->err==ERR_OK) {
|
||||||
if (msg->conn->pcb.tcp != NULL) {
|
if (msg->conn->pcb.tcp != NULL) {
|
||||||
switch (msg->conn->type) {
|
switch (msg->conn->type) {
|
||||||
@ -640,9 +604,7 @@ do_write(struct api_msg_msg *msg)
|
|||||||
#endif
|
#endif
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
msg->conn->err = ERR_VAL;
|
msg->conn->err = ERR_VAL;
|
||||||
break;
|
break;
|
||||||
@ -667,8 +629,7 @@ do_write(struct api_msg_msg *msg)
|
|||||||
(*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDMINUS, msg->msg.w.len);
|
(*msg->conn->callback)(msg->conn, NETCONN_EVT_SENDMINUS, msg->msg.w.len);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,9 +651,7 @@ do_close(struct api_msg_msg *msg)
|
|||||||
#endif
|
#endif
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
/* FALLTHROUGH */
|
|
||||||
case NETCONN_UDP:
|
case NETCONN_UDP:
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
@ -705,8 +664,6 @@ do_close(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
msg->conn->err = err;
|
msg->conn->err = err;
|
||||||
#endif
|
#endif
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sys_mbox_post(msg->conn->mbox, NULL);
|
sys_mbox_post(msg->conn->mbox, NULL);
|
||||||
@ -721,10 +678,6 @@ do_join_leave_group(struct api_msg_msg *msg)
|
|||||||
if (msg->conn->err==ERR_OK) {
|
if (msg->conn->err==ERR_OK) {
|
||||||
if (msg->conn->pcb.tcp != NULL) {
|
if (msg->conn->pcb.tcp != NULL) {
|
||||||
switch (msg->conn->type) {
|
switch (msg->conn->type) {
|
||||||
#if LWIP_RAW
|
|
||||||
case NETCONN_RAW:
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
#if LWIP_UDP
|
#if LWIP_UDP
|
||||||
case NETCONN_UDPLITE:
|
case NETCONN_UDPLITE:
|
||||||
case NETCONN_UDPNOCHKSUM:
|
case NETCONN_UDPNOCHKSUM:
|
||||||
@ -735,12 +688,7 @@ do_join_leave_group(struct api_msg_msg *msg)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif /* LWIP_UDP */
|
#endif /* LWIP_UDP */
|
||||||
#if LWIP_TCP
|
|
||||||
case NETCONN_TCP:
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg->conn->err = err;
|
msg->conn->err = err;
|
||||||
|
Loading…
Reference in New Issue
Block a user