Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linger time = 0 -> unconditional hard disconnect #35

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/api/api_msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -981,14 +981,14 @@ lwip_netconn_do_close_internal(struct netconn *conn WRITE_DELAYED_PARAM)
#if LWIP_SO_LINGER
/* check linger possibilities before calling tcp_close */
err = ERR_OK;
/* linger enabled/required at all? (i.e. is there untransmitted data left?) */
if ((conn->linger >= 0) && (conn->pcb.tcp->unsent || conn->pcb.tcp->unacked)) {
/* linger enabled? */
if (conn->linger >= 0) {
if ((conn->linger == 0)) {
/* data left but linger prevents waiting */
/* 0-timeout linger prevents waiting */
tcp_abort(tpcb);
tpcb = NULL;
} else if (conn->linger > 0) {
/* data left and linger says we should wait */
} else if (conn->pcb.tcp->unsent || conn->pcb.tcp->unacked) {
/* data left and nonzero linger says we should wait */
if (netconn_is_nonblocking(conn)) {
/* data left on a nonblocking netconn -> cannot linger */
err = ERR_WOULDBLOCK;
Expand Down