diff options
author | Volker Lendecke <vl@samba.org> | 2014-07-21 12:35:39 +0000 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2014-08-06 18:01:53 +0200 |
commit | 332eeb8bc152a7ba10c81c92cd8aec21733692c3 (patch) | |
tree | d7cf6487a2350d0c9c4a896c97287757d99ad524 /source3/lib/ctdbd_conn.c | |
parent | c71b0c413c34b2a98557a1baebaebe665b4d8a8c (diff) | |
download | samba-332eeb8bc152a7ba10c81c92cd8aec21733692c3.tar.gz samba-332eeb8bc152a7ba10c81c92cd8aec21733692c3.tar.xz samba-332eeb8bc152a7ba10c81c92cd8aec21733692c3.zip |
ctdbd_conn: Only poll if there's a timeout
At this point the ctdb socket is blocking, so we can save a syscall when
we wait indefinitely anyway.
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Aug 6 18:01:54 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/lib/ctdbd_conn.c')
-rw-r--r-- | source3/lib/ctdbd_conn.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 29482a0e79..3e5e838bd6 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -324,15 +324,17 @@ static NTSTATUS ctdb_read_packet(int fd, TALLOC_CTX *mem_ctx, timeout = -1; } - ret = poll_one_fd(fd, POLLIN, timeout, &revents); - if (ret == -1) { - return map_nt_error_from_unix(errno); - } - if (ret == 0) { - return NT_STATUS_IO_TIMEOUT; - } - if (ret != 1) { - return NT_STATUS_UNEXPECTED_IO_ERROR; + if (timeout != -1) { + ret = poll_one_fd(fd, POLLIN, timeout, &revents); + if (ret == -1) { + return map_nt_error_from_unix(errno); + } + if (ret == 0) { + return NT_STATUS_IO_TIMEOUT; + } + if (ret != 1) { + return NT_STATUS_UNEXPECTED_IO_ERROR; + } } status = read_data(fd, (char *)&msglen, sizeof(msglen)); |