[Freeswitch-svn] [commit] r4774 - freeswitch/trunk/libs/libdingaling/src

Freeswitch SVN mikej at freeswitch.org
Tue Mar 27 00:14:49 EDT 2007


Author: mikej
Date: Tue Mar 27 00:14:48 2007
New Revision: 4774

Modified:
   freeswitch/trunk/libs/libdingaling/src/libdingaling.c

Log:
reconnect on failure

Modified: freeswitch/trunk/libs/libdingaling/src/libdingaling.c
==============================================================================
--- freeswitch/trunk/libs/libdingaling/src/libdingaling.c	(original)
+++ freeswitch/trunk/libs/libdingaling/src/libdingaling.c	Tue Mar 27 00:14:48 2007
@@ -1423,16 +1423,18 @@
 			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 @@
 			}
 
 			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 @@
 			}
 		}
 
+	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);
 



More information about the Freeswitch-svn mailing list