reconnect on failure

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@4774 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-03-27 04:14:48 +00:00
parent d9de1807ee
commit a409072a0f

View File

@ -1423,16 +1423,18 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
break;
case IKS_NET_NODNS:
globals.logger(DL_LOG_DEBUG, "hostname lookup failed\n");
microsleep(1000);
goto fail;
case IKS_NET_NOCONN:
globals.logger(DL_LOG_DEBUG, "connection failed\n");
microsleep(1000);
goto fail;
default:
globals.logger(DL_LOG_DEBUG, "io error %d\n", e);
microsleep(500);
continue;
globals.logger(DL_LOG_DEBUG, "io error 1 %d\n", e);
microsleep(1000);
goto fail;
}
handle->counter = opt_timeout;
if (ldl_test_flag(handle, LDL_FLAG_TLS)) {
launch_queue_thread(handle);
@ -1456,9 +1458,9 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
}
if (IKS_OK != e) {
globals.logger(DL_LOG_DEBUG, "io error %d\n", e);
microsleep(500);
break;
globals.logger(DL_LOG_DEBUG, "io error 2 %d\n", e);
microsleep(1000);
goto fail;
}
@ -1481,10 +1483,12 @@ static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass)
}
}
fail:
iks_disconnect(handle->parser);
iks_parser_delete(handle->parser);
ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED);
ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED);
handle->state = CS_NEW;
}
ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING);