Handle close called before connect.

This commit is contained in:
Stuart Gathman
2005-06-24 03:57:35 +00:00
parent 900b7ef3fb
commit a142fefb19
+15 -1
View File
@@ -34,6 +34,9 @@ $ python setup.py help
libraries=["milter","smutil","resolv"] libraries=["milter","smutil","resolv"]
* $Log$ * $Log$
* Revision 1.2 2005/06/02 04:18:55 customdesigned
* Update copyright notices after reading article on /.
*
* Revision 1.1.1.2 2005/05/31 18:09:06 customdesigned * Revision 1.1.1.2 2005/05/31 18:09:06 customdesigned
* Release 0.7.1 * Release 0.7.1
* *
@@ -715,7 +718,18 @@ milter_wrap_abort(SMFICTX *ctx) {
static int static int
milter_wrap_close(SMFICTX *ctx) { milter_wrap_close(SMFICTX *ctx) {
int r = generic_noarg_wrapper(ctx,close_callback,"milter_wrap_close"); /* We can't use generic_noarg_wrapper because xxfi_close can be
* called out of order - even before connect. There may not
* yet be a private context pointer. */
PyObject *cb = close_callback;
milter_ContextObject *self = smfi_getpriv(ctx);
int r = SMFIS_CONTINUE;
if (self != NULL && cb != NULL && self->ctx == ctx) {
PyObject *arglist;
PyEval_AcquireThread(self->t);
arglist = Py_BuildValue("(O)", self);
r = _generic_wrapper(self, cb, arglist);
}
/* FIXME: It is inefficient to have released the interp lock only to /* FIXME: It is inefficient to have released the interp lock only to
acquire it again in _clear_context. We can tell _generic_return and acquire it again in _clear_context. We can tell _generic_return and
friends not to release the lock by, for instance, setting self->t to NULL. friends not to release the lock by, for instance, setting self->t to NULL.