From 20b4f785b56ff604bab72d3b624aae74a9e5ae5d Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 3 Jul 2006 02:00:51 +0000 Subject: [PATCH] windows-library-cleanup-20060702 Export rx_Finalize and rx_InitHost ==================== This delta was composed from multiple commits as part of the CVS->Git migration. The checkin message with each commit was inconsistent. The following are the additional commit messages. ==================== * add afs_winsockCleanup() call to rx_Finalize * do not start listener threads multiple times ==================== * export rx_Finalize and pr_End ==================== afs_winsockCleanup --- src/libafsauthent/afsauthent.def | 2 ++ src/rx/rx.c | 4 ++++ src/rx/rx_pthread.c | 7 ++++++- src/shlibafsauthent/afsauthent.def | 2 ++ src/util/afsutil.h | 1 + src/util/winsock_nt.c | 11 +++++++++-- 6 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/libafsauthent/afsauthent.def b/src/libafsauthent/afsauthent.def index 15ae52f..687621e 100644 --- a/src/libafsauthent/afsauthent.def +++ b/src/libafsauthent/afsauthent.def @@ -110,6 +110,8 @@ EXPORTS PR_ListSuperGroups @108 ka_AuthSpecificServersConn @109 ka_KeyCheckSum @110 + rx_Finalize @111 + rx_InitHost @112 diff --git a/src/rx/rx.c b/src/rx/rx.c index e58b1d8..436c731 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -2125,6 +2125,10 @@ rx_Finalize(void) } rxi_flushtrace(); +#ifdef AFS_NT40_ENV + afs_winsockCleanup(); +#endif + rxinit_status = 1; UNLOCK_RX_INIT; } diff --git a/src/rx/rx_pthread.c b/src/rx/rx_pthread.c index 5dc4412..b5cc1da 100644 --- a/src/rx/rx_pthread.c +++ b/src/rx/rx_pthread.c @@ -87,7 +87,9 @@ rxi_Delay(int sec) void rxi_InitializeThreadSupport(void) { - listeners_started = 0; + /* listeners_started must only be reset if + * the listener thread terminates */ + /* listeners_started = 0; */ clock_GetTime(&rxi_clockNow); } @@ -323,6 +325,9 @@ rxi_StartListener(void) pthread_attr_t tattr; AFS_SIGSET_DECL; + if (listeners_started) + return; + if (pthread_attr_init(&tattr) != 0) { dpf (("Unable to create Rx event handling thread (pthread_attr_init)\n")); diff --git a/src/shlibafsauthent/afsauthent.def b/src/shlibafsauthent/afsauthent.def index 20fd119..a7199c5 100644 --- a/src/shlibafsauthent/afsauthent.def +++ b/src/shlibafsauthent/afsauthent.def @@ -84,3 +84,5 @@ EXPORTS DISK_function_names @83 DATA VOTE_function_names @84 DATA + rx_Finalize @85 + pr_End @86 diff --git a/src/util/afsutil.h b/src/util/afsutil.h index e697403..3d07415 100644 --- a/src/util/afsutil.h +++ b/src/util/afsutil.h @@ -97,6 +97,7 @@ afs_vsnprintf( /*@out@ */ char *p, size_t avail, const char *fmt, /* Initialize the windows sockets before calling networking routines. */ extern int afs_winsockInit(void); + extern void afs_winsockCleanup(void); struct timezone { int tz_minuteswest; /* of Greenwich */ diff --git a/src/util/winsock_nt.c b/src/util/winsock_nt.c index 1c52330..7d32051 100644 --- a/src/util/winsock_nt.c +++ b/src/util/winsock_nt.c @@ -25,11 +25,11 @@ RCSID * * Returns 0 on success, -1 on error. */ +static int once = 1; + int afs_winsockInit(void) { - static int once = 1; - if (once) { int code; WSADATA data; @@ -48,6 +48,13 @@ afs_winsockInit(void) return 0; } +void +afs_winsockCleanup(void) +{ + WSACleanup(); + once = 0; +} + /* This function will begin to fail in the year 2038 */ int afs_gettimeofday(struct timeval *tv, struct timezone *tz) -- 1.9.4