FastCGI Developer's Kit README
------------------------------
- $Id: README,v 1.10 2001/11/27 12:58:34 robs Exp $
+ $Id: README,v 1.11 2001/11/30 17:48:58 robs Exp $
Copyright (c) 1996 Open Market, Inc.
See the file "LICENSE.TERMS" for information on usage and redistribution
of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Unfortunately documentation of many of the changes have been lost.
+2.2.3
+-----
+
+ *) (WIN32) Fixed initialization of the accept mutex when OpenSocket() was used.
+ Niklas Bergh [niklas.bergh@tific.com]
+
2.2.2
-----
* significantly more enjoyable.)
*/
#ifndef lint
-static const char rcsid[] = "$Id: os_win32.c,v 1.24 2001/09/14 19:43:27 robs Exp $";
+static const char rcsid[] = "$Id: os_win32.c,v 1.25 2001/11/30 17:48:57 robs Exp $";
#endif /* not lint */
#define WIN32_LEAN_AND_MEAN
static HANDLE stdioHandles[3] = {INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE,
INVALID_HANDLE_VALUE};
+// This is a nail for listening to more than one port..\r
static HANDLE acceptMutex = INVALID_HANDLE_VALUE;
static BOOLEAN shutdownPending = FALSE;
}
}
- /*
- * If an accept mutex is in the env, save it and remove it.
- */
- val = getenv(MUTEX_VARNAME);
- if (val != NULL)
- {
- acceptMutex = (HANDLE) atoi(val);
+ if (acceptMutex == INVALID_HANDLE_VALUE)\r
+ {\r
+ /* If an accept mutex is in the env, use it */
+ val = getenv(MUTEX_VARNAME);
+ if (val != NULL)
+ {
+ acceptMutex = (HANDLE) atoi(val);
+ }\r
}
-
/*
* Determine if this library is being used to listen for FastCGI
* connections. This is communicated by STDIN containing a
{
int pseudoFd = -1;
short port = getPort(bindPath);
- HANDLE mutex = CreateMutex(NULL, FALSE, NULL);
- char * mutexEnvString;
- if (mutex == NULL)
- {
- return -2;
- }
-
- if (! SetHandleInformation(mutex, HANDLE_FLAG_INHERIT, TRUE))
- {
- return -3;
+ if (acceptMutex == INVALID_HANDLE_VALUE)\r
+ {\r
+ acceptMutex = CreateMutex(NULL, FALSE, NULL);\r
+ if (acceptMutex == NULL) return -2;
+ if (! SetHandleInformation(acceptMutex, HANDLE_FLAG_INHERIT, TRUE)) return -3;
}
- // This is a nail for listening to more than one port..
- // This should really be handled by the caller.
-
- mutexEnvString = malloc(strlen(MUTEX_VARNAME) + 7);
- sprintf(mutexEnvString, MUTEX_VARNAME "=%d", (int) mutex);
- putenv(mutexEnvString);
-
// There's nothing to be gained (at the moment) by a shutdown Event
if (port && *bindPath != ':' && strncmp(bindPath, LOCALHOST, strlen(LOCALHOST)))