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

tcp_poll:Modify the TCP poll processing strategy when the network driver is down #192

Merged
merged 1 commit into from
Feb 25, 2025
Merged
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
9 changes: 9 additions & 0 deletions net/tcp/tcp_netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,14 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
}
}

if (conn->dev &&
!(netdev_verify(conn->dev) && IFF_IS_UP(conn->dev->d_flags)))
{
_SO_CONN_SETERRNO(conn, ENETDOWN);
eventset |= POLLERR | POLLHUP;
goto notify;
}

/* Allocate a TCP/IP callback structure */

cb = tcp_callback_alloc(conn);
Expand Down Expand Up @@ -356,6 +364,7 @@ int tcp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)

/* Check if any requested events are already in effect */

notify:
poll_notify(&fds, 1, eventset);

errout_with_lock:
Expand Down
Loading