Wed 28 Feb 2007 08:11:09 AM UTC, comment #4:
I have a question about the issue.
TCP state is CLOSE_WAIT, that is mean the TCP receive FIN and send ACK of the FIN, In this state, TCP still could send data to the Server/Client.
So I think the codes should not be changed.
|
Mon 26 Feb 2007 02:45:29 PM UTC, comment #2:
It wasn't me that posted this bug, but I can see what's proposed. If writing to a TCP connection already in the CLOSE_WAIT state, ERR_CONN is returned, equivalent to ENOTCONN in BSD sockets. The patch wants to return ESHUTDOWN instead (although the patch is incorrect and should return ERR_CLSD if it wants that behaviour) in that case. This would indeed be the strictly correct error code.
Incidentally, it's impossible to have dialogue with anonymous submitters - is allowing anonymous submissions perhaps an option that could be turned off?
|
Thu 07 Apr 2005 11:43:16 AM UTC, original submission:
Possible work around tcp_out.c:
err_t
tcp_write(struct tcp_pcb pcb, const void arg, u16_t len, u8_t copy)
{
LWIP_DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_write(pcb=%p, arg=%p, len=%u, copy=%d)\n", (void *)pcb,
arg, len, (unsigned int)copy));
/* connection is in valid state for data transmission? */
if (pcb->state == ESTABLISHED ||
pcb->state == SYN_SENT ||
pcb->state == SYN_RCVD) {
if (len > 0) {
return tcp_enqueue(pcb, (void *)arg, len, 0, copy, NULL, 0);
}
return ERR_OK;
} else if (pcb->state == CLOSE_WAIT) {
/* FIX: shutdown was not recognized. */
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() in state CLOSE_WAIT\n"));
return ESHUTDOWN;
} else {
LWIP_DEBUGF(TCP_OUTPUT_DEBUG | DBG_STATE | 3, ("tcp_write() called in invalid state\n"));
return ERR_CONN;
}
}
|