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

Shutdown only if CLOSE has been set to xprt->xp_flags #318

Open
wants to merge 1 commit into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
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: 6 additions & 3 deletions ntirpc/rpc/svc.h
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,12 @@ static inline void svc_destroy_it(SVCXPRT *xprt,
(*(xprt)->xp_ops->xp_unref_user_data)(xprt);
}

/* Let's shutdown the sockets so that FIN-ACK could be sent to the
* client immediately. */
if (xprt->xp_fd != RPC_ANYFD) {
/* Check if the connection was already set as dead or closed,
* If set, let's cleanup and close the FDs, so that FIN-ACK
* could be sent to the client immediately.
* Also for UDP xprt, this is never set, needn't enter here */
if ((atomic_fetch_uint16_t(&xprt->xp_flags) & SVC_XPRT_FLAG_CLOSE)
&& xprt->xp_fd != RPC_ANYFD) {
(void)shutdown(xprt->xp_fd, SHUT_RDWR);
if (xprt->xp_fd_send != RPC_ANYFD)
(void)shutdown(xprt->xp_fd_send, SHUT_RDWR);
Expand Down
10 changes: 5 additions & 5 deletions src/svc_dg.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,16 +280,16 @@ svc_dg_rendezvous(SVCXPRT *xprt)
}

if (sp->sa_family == (sa_family_t) 0xffff) {
__warnx(TIRPC_DEBUG_FLAG_ERROR,
"%s: Bad message sa_family is 0xffff",
__func__);
__warnx(TIRPC_DEBUG_FLAG_ERROR,
"%s: xprt(%p) newxprt(%p) fd %d Bad message sa_family is 0xffff",
__func__, xprt, newxprt, newxprt->xp_fd);
return SVC_STAT(xprt);
}

if (rlen == -1 || (rlen < (ssize_t) (4 * sizeof(u_int32_t)))) {
__warnx(TIRPC_DEBUG_FLAG_ERROR,
"%s: Bad message rlen: %d",
__func__, rlen);
"%s: xprt(%p) newxprt(%p) fd %d Bad message rlen: %d",
__func__, xprt, newxprt, newxprt->xp_fd, rlen);
return SVC_STAT(xprt);
}

Expand Down