When rxBind was added it made an assumption that rx_GetIFInfo could be
called before rx_InitXYZ. This is true on non-Windows platforms, but
on Windows rxGetIFInfo relies on an initialized mutex. This patch adds
a DllMain for Windows in order to initialize the mutex object upon DLL
load.
(cherry picked from commit
5b56a0b8ebbdfffa46b90d45b06253c3c6fade15)
rx_InitHost @224
rx_NewServiceHost @225
osi_AssertFailU @226
+ DllMain @227
return 0;
return rxi_rxstat_userok(call);
}
+
+#ifdef AFS_NT40_ENV
+/*
+ * DllMain() -- Entry-point function called by the DllMainCRTStartup()
+ * function in the MSVC runtime DLL (msvcrt.dll).
+ *
+ * Note: the system serializes calls to this function.
+ */
+BOOL WINAPI
+DllMain(HINSTANCE dllInstHandle, /* instance handle for this DLL module */
+ DWORD reason, /* reason function is being called */
+ LPVOID reserved) /* reserved for future use */
+{
+ switch (reason) {
+ case DLL_PROCESS_ATTACH:
+ /* library is being attached to a process */
+ INIT_PTHREAD_LOCKS;
+ return TRUE;
+
+ case DLL_PROCESS_DETACH:
+ return TRUE;
+
+ default:
+ return FALSE;
+ }
+}
+#endif
+
/* The IP address list can change so we must query for it */
rx_GetIFInfo();
+#ifndef AFS_NT40_ENV
/* we don't want to use the loopback adapter which is first */
- /* this is a bad bad hack */
+ /* this is a bad bad hack.
+ * and doesn't hold true on Windows.
+ */
if ( rxi_numNetAddrs > 1 )
offset = 1;
+#endif /* AFS_NT40_ENV */
for (count = 0; offset < rxi_numNetAddrs && maxSize > 0;
count++, offset++, maxSize--)