s3:rpc_client: return at least 10 sec as old timeout in rpccli_set_timeout() instead...
authorStefan Metzmacher <metze@samba.org>
Sun, 28 Mar 2010 17:34:34 +0000 (19:34 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 29 Mar 2010 16:11:17 +0000 (18:11 +0200)
metze

source3/rpc_client/cli_pipe.c

index 5ee6dcb2b548de62e49c7e56e1b8962c82553e7e..8d33d7713f40afc0c9028bde396f22ce54386a1e 100644 (file)
@@ -3064,18 +3064,27 @@ NTSTATUS rpc_pipe_bind(struct rpc_pipe_client *cli,
        return status;
 }
 
+#define RPCCLI_DEFAULT_TIMEOUT 10000 /* 10 seconds. */
+
 unsigned int rpccli_set_timeout(struct rpc_pipe_client *rpc_cli,
                                unsigned int timeout)
 {
+       unsigned int old;
+
        if (rpc_cli->transport == NULL) {
-               return 0;
+               return RPCCLI_DEFAULT_TIMEOUT;
        }
 
        if (rpc_cli->transport->set_timeout == NULL) {
-               return 0;
+               return RPCCLI_DEFAULT_TIMEOUT;
+       }
+
+       old = rpc_cli->transport->set_timeout(rpc_cli->transport->priv, timeout);
+       if (old == 0) {
+               return RPCCLI_DEFAULT_TIMEOUT;
        }
 
-       return rpc_cli->transport->set_timeout(rpc_cli->transport->priv, timeout);
+       return old;
 }
 
 bool rpccli_is_connected(struct rpc_pipe_client *rpc_cli)