sock/posix: fix the socket pipe_has_data or socket_has_data.

After reading the code in detail, I think that we should
not set pipe_has_data= true and socket_has_data at the same time.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
Change-Id: I8f9f96b16f4f0e0c585877a0dd687a240252a7cf
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/8283
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ziye Yang 2021-06-02 19:35:53 +08:00 committed by Tomasz Zawadzki
parent 1347830beb
commit 2cd948c4a6

View File

@ -958,10 +958,7 @@ posix_sock_read(struct spdk_posix_sock *sock)
#endif
sock->pipe_has_data = true;
if (bytes_recvd < bytes_avail) {
/* We drained the kernel socket entirely. */
sock->socket_has_data = false;
}
sock->socket_has_data = false;
return bytes_recvd;
}
@ -1454,6 +1451,7 @@ posix_sock_group_impl_poll(struct spdk_sock_group_impl *_group, int max_events,
if (!psock->socket_has_data && !psock->pipe_has_data) {
TAILQ_INSERT_TAIL(&group->socks_with_data, psock, link);
}
psock->socket_has_data = true;
}