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= mount uid or username\n\ gid= mount gid or groupname\n\ port= remote SMB port number\n\ + timeout= connection timeout\n\ fmask= file umask\n\ dmask= directory umask\n\ debug= 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 */