88 |
} |
} |
89 |
return ERR_OK; |
return ERR_OK; |
90 |
} else { |
} else { |
91 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write() called in invalid state\n")); |
DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() called in invalid state\n")); |
92 |
return ERR_CONN; |
return ERR_CONN; |
93 |
} |
} |
94 |
} |
} |
206 |
/* If allocation fails, we have to deallocate the data pbuf as |
/* If allocation fails, we have to deallocate the data pbuf as |
207 |
well. */ |
well. */ |
208 |
pbuf_free(p); |
pbuf_free(p); |
209 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for header pbuf\n")); |
DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for header pbuf\n")); |
210 |
goto memerr; |
goto memerr; |
211 |
} |
} |
212 |
++queuelen; |
++queuelen; |
231 |
/* Build TCP header. */ |
/* Build TCP header. */ |
232 |
if (pbuf_header(seg->p, TCP_HLEN)) { |
if (pbuf_header(seg->p, TCP_HLEN)) { |
233 |
|
|
234 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: no room for TCP header in pbuf.\n")); |
DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: no room for TCP header in pbuf.\n")); |
235 |
|
|
236 |
#ifdef TCP_STATS |
#ifdef TCP_STATS |
237 |
++lwip_stats.tcp.err; |
++lwip_stats.tcp.err; |
257 |
segments such as SYN|ACK. */ |
segments such as SYN|ACK. */ |
258 |
memcpy(seg->dataptr, optdata, optlen); |
memcpy(seg->dataptr, optdata, optlen); |
259 |
} |
} |
260 |
DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: queueing %lu:%lu (0x%x)\n", |
DEBUGF(TCP_OUTPUT_DEBUG | DBG_TRACE, ("tcp_enqueue: queueing %lu:%lu (0x%x)\n", |
261 |
ntohl(seg->tcphdr->seqno), |
ntohl(seg->tcphdr->seqno), |
262 |
ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg), |
ntohl(seg->tcphdr->seqno) + TCP_TCPLEN(seg), |
263 |
flags)); |
flags)); |
343 |
pcb->unsent != NULL); |
pcb->unsent != NULL); |
344 |
|
|
345 |
} |
} |
346 |
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen)); |
DEBUGF(TCP_QLEN_DEBUG | DBG_STATE, ("tcp_enqueue: %d (with mem err)\n", pcb->snd_queuelen)); |
347 |
return ERR_MEM; |
return ERR_MEM; |
348 |
} |
} |
349 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |