summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-09-06 19:02:39 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:43:56 -0500
commit012c9e9cf9db9147cd95e1abb0f8db0548e0a9d9 (patch)
tree1dfb91bb95dba6260f4b0efd2e91bc9c918639eb /source3
parent995205fc60f87e1a02aa1c6f309db55ae18e908a (diff)
downloadsamba-012c9e9cf9db9147cd95e1abb0f8db0548e0a9d9.tar.gz
samba-012c9e9cf9db9147cd95e1abb0f8db0548e0a9d9.tar.bz2
samba-012c9e9cf9db9147cd95e1abb0f8db0548e0a9d9.zip
r18189: When tearing down a connection we can be harsher
with timeouts. Also, wait for 5 seconds not 10 on connecting to a DC. Jeremy. (This used to be commit 6792460ba6a198646404abae10979489ca03ca5c)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/winbindd_cm.c34
1 files changed, 29 insertions, 5 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 85b1d5d6cd..76c0c48232 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -757,7 +757,8 @@ static BOOL find_new_dc(TALLOC_CTX *mem_ctx,
if ((addrs == NULL) || (dcnames == NULL))
return False;
- if ( !open_any_socket_out(addrs, num_addrs, 10000, &fd_index, fd) )
+ /* 5 second timeout. */
+ if ( !open_any_socket_out(addrs, num_addrs, 5000, &fd_index, fd) )
{
for (i=0; i<num_dcs; i++) {
add_failed_connection_entry(domain->name,
@@ -847,7 +848,8 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
add_sockaddr_to_array(mem_ctx, domain->dcaddr.sin_addr, 445, &addrs, &num_addrs);
add_sockaddr_to_array(mem_ctx, domain->dcaddr.sin_addr, 139, &addrs, &num_addrs);
- if (!open_any_socket_out(addrs, num_addrs, 10000, &dummy, &fd)) {
+ /* 5 second timeout. */
+ if (!open_any_socket_out(addrs, num_addrs, 5000, &dummy, &fd)) {
domain->online = False;
fd = -1;
}
@@ -890,18 +892,40 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain,
void invalidate_cm_connection(struct winbindd_cm_conn *conn)
{
+ /* We're closing down a possibly dead
+ connection. Don't have impossibly long (10s) timeouts. */
+
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 1000); /* 1 second. */
+ }
+
if (conn->samr_pipe != NULL) {
- cli_rpc_pipe_close(conn->samr_pipe);
+ if (!cli_rpc_pipe_close(conn->samr_pipe)) {
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
+ }
+ }
conn->samr_pipe = NULL;
}
if (conn->lsa_pipe != NULL) {
- cli_rpc_pipe_close(conn->lsa_pipe);
+ if (!cli_rpc_pipe_close(conn->lsa_pipe)) {
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
+ }
+ }
conn->lsa_pipe = NULL;
}
if (conn->netlogon_pipe != NULL) {
- cli_rpc_pipe_close(conn->netlogon_pipe);
+ if (!cli_rpc_pipe_close(conn->netlogon_pipe)) {
+ /* Ok, it must be dead. Drop timeout to 0.5 sec. */
+ if (conn->cli) {
+ cli_set_timeout(conn->cli, 500);
+ }
+ }
conn->netlogon_pipe = NULL;
}