Fixed LWIP_NETIF_TX_SINGLE_PBUF for LWIP_TCPIP_CORE_LOCKING

This commit is contained in:
goldsimon 2010-03-06 11:52:55 +00:00
parent a5a870c683
commit f5b783d107
2 changed files with 15 additions and 6 deletions

View File

@ -147,6 +147,9 @@ HISTORY
++ Bugfixes:
2010-03-06: Simon Goldschmidt
* sockets.c: Fixed LWIP_NETIF_TX_SINGLE_PBUF for LWIP_TCPIP_CORE_LOCKING
2010-03-06: Simon Goldschmidt
* ipv4/ip.c: Don't try to forward link-local addresses

View File

@ -772,6 +772,7 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
#endif /* LWIP_TCP */
}
/* @todo: split into multiple sendto's? */
LWIP_ASSERT("lwip_sendto: size must fit in u16_t", size <= 0xffff);
short_size = (u16_t)size;
LWIP_ERROR("lwip_sendto: invalid address", (((to == NULL) && (tolen == 0)) ||
@ -783,12 +784,15 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
/* Should only be consider like a sample or a simple way to experiment this option (no check of "to" field...) */
{ struct pbuf* p;
p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_REF);
if (p == NULL) {
err = ERR_MEM;
} else {
#if LWIP_NETIF_TX_SINGLE_PBUF
p = pbuf_alloc(PBUF_TRANSPORT, short_size, PBUF_RAM);
if (p != NULL) {
MEMCPY(p->payload, data, size);
#else /* LWIP_NETIF_TX_SINGLE_PBUF */
p = pbuf_alloc(PBUF_TRANSPORT, short_size, PBUF_REF);
if (p != NULL) {
p->payload = (void*)data;
p->len = p->tot_len = short_size;
#endif /* LWIP_NETIF_TX_SINGLE_PBUF */
inet_addr_to_ipaddr(&remote_addr, &((const struct sockaddr_in *)to)->sin_addr);
@ -801,6 +805,8 @@ lwip_sendto(int s, const void *data, size_t size, int flags,
UNLOCK_TCPIP_CORE();
pbuf_free(p);
} else {
err = ERR_MEM;
}
}
#else