svn commit: samba r11790 - branches/SAMBA_3_0/source/client
trunk/source/client
gd at samba.org
gd at samba.org
Fri Nov 18 14:33:13 GMT 2005
Author: gd
Date: 2005-11-18 14:33:12 +0000 (Fri, 18 Nov 2005)
New Revision: 11790
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=11790
Log:
Avoid infinite retry to gather a connection.
Guenther
Modified:
branches/SAMBA_3_0/source/client/smbspool.c
trunk/source/client/smbspool.c
Changeset:
Modified: branches/SAMBA_3_0/source/client/smbspool.c
===================================================================
--- branches/SAMBA_3_0/source/client/smbspool.c 2005-11-18 14:13:49 UTC (rev 11789)
+++ branches/SAMBA_3_0/source/client/smbspool.c 2005-11-18 14:33:12 UTC (rev 11790)
@@ -30,6 +30,7 @@
#define CC_MAX_FILE_PATH_LEN (sizeof(TICKET_CC_DIR)-1)+ CC_MAX_FILE_LEN+2
#define OVERWRITE 1
#define KRB5CCNAME "KRB5CCNAME"
+#define MAX_RETRY_CONNECT 3
/*
@@ -71,6 +72,7 @@
int status=0; /* Status of LPD job */
struct cli_state *cli; /* SMB interface */
char null_str[1];
+ int tries = 0;
null_str[0] = '\0';
@@ -229,18 +231,24 @@
{
if (getenv("CLASS") == NULL)
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...\n");
sleep (60); /* should just waiting and retrying fix authentication ??? */
+ tries++;
}
else
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...\n");
return (1);
}
}
}
- while (cli == NULL);
+ while ((cli == NULL) && (tries < MAX_RETRY_CONNECT));
+ if (cli == NULL) {
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host after (tried %d times)\n", tries);
+ return (1);
+ }
+
/*
* Now that we are connected to the server, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
Modified: trunk/source/client/smbspool.c
===================================================================
--- trunk/source/client/smbspool.c 2005-11-18 14:13:49 UTC (rev 11789)
+++ trunk/source/client/smbspool.c 2005-11-18 14:33:12 UTC (rev 11790)
@@ -30,6 +30,7 @@
#define CC_MAX_FILE_PATH_LEN (sizeof(TICKET_CC_DIR)-1)+ CC_MAX_FILE_LEN+2
#define OVERWRITE 1
#define KRB5CCNAME "KRB5CCNAME"
+#define MAX_RETRY_CONNECT 3
/*
@@ -71,6 +72,7 @@
int status=0; /* Status of LPD job */
struct cli_state *cli; /* SMB interface */
char null_str[1];
+ int tries = 0;
null_str[0] = '\0';
@@ -229,18 +231,24 @@
{
if (getenv("CLASS") == NULL)
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, will retry in 60 seconds...\n");
sleep (60); /* should just waiting and retrying fix authentication ??? */
+ tries++;
}
else
{
- fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...");
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host, trying next printer...\n");
return (1);
}
}
}
- while (cli == NULL);
+ while ((cli == NULL) && (tries < MAX_RETRY_CONNECT));
+ if (cli == NULL) {
+ fprintf(stderr, "ERROR: Unable to connect to CIFS host after (tried %d times)\n", tries);
+ return (1);
+ }
+
/*
* Now that we are connected to the server, ignore SIGTERM so that we
* can finish out any page data the driver sends (e.g. to eject the
More information about the samba-cvs
mailing list