mirror of
https://github.com/ep00ch/lwip-contrib-mac.git
synced 2024-06-10 18:29:27 +00:00
udpecho: no need netconn_connect, since the netbuf contains the address (bug #34921)
This commit is contained in:
parent
5ab0be592b
commit
00b2bb461a
|
@ -60,11 +60,18 @@ udpecho_thread(void *arg)
|
||||||
if (err == ERR_OK) {
|
if (err == ERR_OK) {
|
||||||
addr = netbuf_fromaddr(buf);
|
addr = netbuf_fromaddr(buf);
|
||||||
port = netbuf_fromport(buf);
|
port = netbuf_fromport(buf);
|
||||||
netconn_connect(conn, addr, port);
|
// no need netconn_connect here, since the netbuf contains the address
|
||||||
netbuf_copy(buf, buffer, buf->p->tot_len);
|
if(netbuf_copy(buf, buffer, buf->p->tot_len) != buf->p->tot_len) {
|
||||||
buffer[buf->p->tot_len] = '\0';
|
LWIP_DEBUGF(LWIP_DBG_ON, ("netbuf_copy failed\n"));
|
||||||
netconn_send(conn, buf);
|
} else {
|
||||||
LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer));
|
buffer[buf->p->tot_len] = '\0';
|
||||||
|
err = netconn_send(conn, buf);
|
||||||
|
if(err != ERR_OK) {
|
||||||
|
LWIP_DEBUGF(LWIP_DBG_ON, ("netconn_send failed: %d\n", (int)err));
|
||||||
|
} else {
|
||||||
|
LWIP_DEBUGF(LWIP_DBG_ON, ("got %s\n", buffer));
|
||||||
|
}
|
||||||
|
}
|
||||||
netbuf_delete(buf);
|
netbuf_delete(buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user