The Samba-Bugzilla – Attachment 469 Details for
Bug 1267
Add better timeout handling to smbmount and client apps
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
solution for both problems
DIFF.patch (text/plain), 2.25 KB, created by
Wim Delvaux
on 2004-04-15 15:37:57 UTC
(
hide
)
Description:
solution for both problems
Filename:
MIME Type:
Creator:
Wim Delvaux
Created:
2004-04-15 15:37:57 UTC
Size:
2.25 KB
patch
obsolete
>diff --exclude '*.o' -Naur samba-3.0.2a/source/client/smbmount.c samba-3.0.2a-mine/source/client/smbmount.c >--- samba-3.0.2a/source/client/smbmount.c 2003-08-28 23:42:42.000000000 +0200 >+++ samba-3.0.2a-mine/source/client/smbmount.c 2004-04-10 19:35:52.000000000 +0200 >@@ -40,6 +40,7 @@ > > static struct in_addr dest_ip; > static BOOL have_ip; >+static unsigned int smb_thetimeout=0; > static int smb_port = 0; > static BOOL got_user; > static BOOL got_pass; >@@ -151,7 +152,9 @@ > if (have_ip) ip = dest_ip; > > /* have to open a new connection */ >- if (!(c=cli_initialise(NULL)) || (cli_set_port(c, smb_port) != smb_port) || >+ if (!(c=cli_initialise(NULL)) || >+ (cli_set_port(c, smb_port) != smb_port) || >+ (smb_thetimeout && ! cli_set_timeout(c, smb_thetimeout) ) || > !cli_connect(c, server_n, &ip)) { > DEBUG(0,("%d: Connection to %s failed\n", sys_getpid(), server_n)); > if (c) { >@@ -675,6 +678,7 @@ > uid=<arg> mount uid or username\n\ > gid=<arg> mount gid or groupname\n\ > port=<arg> remote SMB port number\n\ >+ timeout=<arg> connection timeout\n\ > fmask=<arg> file umask\n\ > dmask=<arg> directory umask\n\ > debug=<arg> debug level\n\ >@@ -786,6 +790,8 @@ > mount_gid = nametogid(opteq+1); > } else if(!strcmp(opts, "port")) { > smb_port = val; >+ } else if(!strcmp(opts, "timeout")) { >+ smb_thetimeout = (unsigned)val; > } else if(!strcmp(opts, "fmask")) { > mount_fmask = strtol(opteq+1, NULL, 8); > } else if(!strcmp(opts, "dmask")) { >diff --exclude '*.o' -Naur samba-3.0.2a/source/lib/util_sock.c samba-3.0.2a-mine/source/lib/util_sock.c >--- samba-3.0.2a/source/lib/util_sock.c 2004-02-06 23:40:30.000000000 +0100 >+++ samba-3.0.2a-mine/source/lib/util_sock.c 2004-04-10 19:37:45.000000000 +0200 >@@ -718,6 +718,8 @@ > if (ret < 0 && (errno == EINPROGRESS || errno == EALREADY || > errno == EAGAIN) && (connect_loop < timeout) ) { > msleep(connect_loop); >+ // update timeout so we do not sleep the SUM of all connect loops >+ timeout -= connect_loop; > connect_loop += increment; > if (increment < 250) { > /* After 8 rounds we end up at a max of 255 msec */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 1267
: 469