repo: ngircd
action: commit
revision: 
path_from: 
revision_from: 5049c5c694281f63d56e138d2333fefed4cfe47a:
path_to: 
revision_to: 
git.thebackupbox.net
ngircd
git clone git://git.thebackupbox.net/ngircd
commit 5049c5c694281f63d56e138d2333fefed4cfe47a
Author: Alexander Barton 
Date:   Sun Dec 26 16:48:53 2004 +0000

    Don't use a POSIX thread for the Howl "run loop".

diff --git a/src/ngircd/rendezvous.c b/src/ngircd/rendezvous.c
index 720f5dfe57d3368f5300c13d3bfec725a060f8cb..
index ..5272cfa8bba369f5d17b6112b1b4d655656f2bde 100644
--- a/src/ngircd/rendezvous.c
+++ b/src/ngircd/rendezvous.c
@@ -21,7 +21,7 @@
 #ifdef RENDEZVOUS


-static char UNUSED id[] = "$Id: rendezvous.c,v 1.3 2004/12/26 00:14:33 alex Exp $";
+static char UNUSED id[] = "$Id: rendezvous.c,v 1.4 2004/12/26 16:48:53 alex Exp $";

 #include "imp.h"
 #include 
@@ -93,16 +93,11 @@ LOCAL VOID Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrC

 #ifdef HOWL

-#include 
-
 LOCAL sw_discovery My_Discovery_Session = NULL;
-LOCAL pthread_t My_Howl_Thread;
-LOCAL BOOLEAN My_Howl_Thread_Created = FALSE;
+LOCAL sw_salt My_Salt;

 LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, sw_discovery_oid Id, sw_opaque Extra );

-LOCAL VOID* Howl_Thread( VOID *x );
-
 #endif /* Howl */


@@ -119,6 +114,13 @@ GLOBAL VOID Rendezvous_Init( VOID )
 		Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
 		exit( 1 );
 	}
+
+	if( sw_discovery_salt( My_Discovery_Session, &My_Salt ) != SW_OKAY )
+	{
+		Log( LOG_EMERG, "Can't initialize Rendezvous (Howl): sw_discovery_salt() failed!" );
+		Log( LOG_ALERT, "%s exiting due to fatal errors!", PACKAGE_NAME );
+		exit( 1 );
+	}
 #endif

 	for( i = 0; i < MAX_RENDEZVOUS; i++ ) My_Rendezvous[i].Desc[0] = '\0';
@@ -137,12 +139,6 @@ GLOBAL VOID Rendezvous_Exit( VOID )
 	}

 #ifdef HOWL
-	if( My_Howl_Thread_Created )
-	{
-		Log( LOG_DEBUG, "Rendezvous: Canceling management thread ..." );
-		pthread_cancel( My_Howl_Thread );
-	}
-
 	sw_discovery_fina( My_Discovery_Session );
 #endif
 } /* Rendezvous_Exit */
@@ -261,13 +257,8 @@ GLOBAL VOID Rendezvous_Handler( VOID )
 #endif /* Apple */

 #ifdef HOWL
-	if( My_Discovery_Session != NULL && My_Howl_Thread_Created == FALSE )
-	{
-		/* Create POSIX thread for sw_discovery_run() */
-		Log( LOG_DEBUG, "Rendezvous: Creating management thread ..." );
-		pthread_create( &My_Howl_Thread, NULL, Howl_Thread, NULL );
-		My_Howl_Thread_Created = TRUE;
-	}
+	sw_ulong msecs = 10;
+	sw_salt_step( My_Salt, &msecs );
 #endif
 } /* Rendezvous_Handler */

@@ -366,14 +357,6 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_di
 } /* Registration_Reply_Handler */


-LOCAL VOID *Howl_Thread( VOID *x )
-{
-	assert( x == NULL );
-	sw_discovery_run( My_Discovery_Session );
-	pthread_exit( NULL );
-} /* Howl_Thread */
-
-
 #endif /* Howl */


-----END OF PAGE-----