svn commit: samba r7025 - in branches/SAMBA_3_0/source: lib tdb
derrell at samba.org
derrell at samba.org
Fri May 27 20:07:56 GMT 2005
Jeremy Allison <jra at samba.org> writes:
> Try this instead. Much simpler.
>
> Index: lib/util_sock.c
> ===================================================================
> --- lib/util_sock.c (revision 7038)
> +++ lib/util_sock.c (working copy)
> @@ -597,7 +597,12 @@
> }
>
> if(len > 0) {
> - ret = read_socket_data(fd,buffer+4,len);
> + if (timeout > 0) {
> + ret = read_socket_with_timeout(fd,buffer+4,len,len,timeout);
> + } else {
> + ret = read_socket_data(fd,buffer+4,len);
> + }
> +
> if (ret != len) {
> if (smb_read_error == 0)
> smb_read_error = READ_ERROR;
tridge had specifically recommended against this because of the added overhead
of read_socket_with_timeout() on each usage. Thus I had written it to use
read_socket_data() initially and only call read_socket_with_timeout() if
EAGAIN occurred. Since we have no way to "unread" the partial packet consumed
by read_socket_data(), and you don't want to change the semantics of
read_socket_data() to return a partial packet, this slower method may be the
best we can do.
Do you want to check it in, shall I?
Cheers,
Derrell
More information about the samba-technical
mailing list