* See the file "LICENSE.TERMS" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
- * $Id: fcgiapp.h,v 1.5 2000/11/05 17:09:36 robs Exp $
+ * $Id: fcgiapp.h,v 1.6 2001/06/22 13:17:18 skimo Exp $
*/
#ifndef _FCGIAPP_H
*
* FCGX_Free --
*
- * Free the memory and IPC FD associated with the request (multi-thread safe).
+ * Free the memory and, if close is true,
+ * IPC FD associated with the request (multi-thread safe).
*
*----------------------------------------------------------------------
*/
-DLLAPI void FCGX_Free(FCGX_Request * request);
+DLLAPI void FCGX_Free(FCGX_Request * request, int close);
/*
*----------------------------------------------------------------------
*
*/
#ifndef lint
-static const char rcsid[] = "$Id: fcgiapp.c,v 1.24 2001/06/22 09:12:03 skimo Exp $";
+static const char rcsid[] = "$Id: fcgiapp.c,v 1.25 2001/06/22 13:17:19 skimo Exp $";
#endif /* not lint */
#include <assert.h>
*/
void FCGX_Finish_r(FCGX_Request *reqDataPtr)
{
+ int close;
+
if (reqDataPtr == NULL) {
return;
}
+ close = !reqDataPtr->keepConnection;
+
/* This should probably use a 'status' member instead of 'in' */
if (reqDataPtr->in) {
- int errStatus = FCGX_FClose(reqDataPtr->err);
- int outStatus = FCGX_FClose(reqDataPtr->out);
+ close |= FCGX_FClose(reqDataPtr->err);
+ close |= FCGX_FClose(reqDataPtr->out);
- if (errStatus || outStatus || FCGX_GetError(reqDataPtr->in))
- {
- OS_IpcClose(reqDataPtr->ipcFd);
- reqDataPtr->ipcFd = -1;
- }
+ close |= FCGX_GetError(reqDataPtr->in);
}
- FCGX_Free(reqDataPtr);
+ FCGX_Free(reqDataPtr, close);
}
-void FCGX_Free(FCGX_Request * request)
+void FCGX_Free(FCGX_Request * request, int close)
{
if (request == NULL)
return;
FreeStream(&request->err);
FreeParams(&request->paramsPtr);
- if (!request->keepConnection)
- {
+ if (close) {
OS_IpcClose(request->ipcFd);
request->ipcFd = -1;
}
* Close the connection and try again.
*/
TryAgain:
- reqDataPtr->keepConnection = 0;
- FCGX_Free(reqDataPtr);
+ FCGX_Free(reqDataPtr, 1);
} /* for (;;) */
/*
print OUT while <DATA>;
close OUT;
__END__
-/* $Id: FCGI.XL,v 1.1 2000/12/31 21:46:58 skimo Exp $ */
+/* $Id: FCGI.XL,v 1.2 2001/06/22 13:17:20 skimo Exp $ */
#include "EXTERN.h"
#include "perl.h"
if (was_bound)
FCGX_Finish_r(request->requestPtr);
else
- FCGX_Free(request->requestPtr);
+ FCGX_Free(request->requestPtr, 1);
request->accepted = FALSE;
}