MCPcopy Create free account
hub / github.com/mhammond/pywin32 / IOCompletion

Method IOCompletion

isapi/src/PyExtensionObjects.cpp:801–828  ·  view source on GitHub ↗

@pymethod int|EXTENSION_CONTROL_BLOCK|IOCompletion|Set a callback that will be used for handling asynchronous I/O operations. @comm If you call this multiple times, the previous callback will be discarded. @comm A reference to the callback and args are held until is called. If the callback function fails, DoneWithSession(HSE_STATUS_ERROR) will automatic

Source from the content-addressed store, hash-verified

799// function fails, DoneWithSession(HSE_STATUS_ERROR) will automatically be
800// called and no further callbacks for the ECB will be made.
801PyObject * PyECB::IOCompletion(PyObject *self, PyObject *args)
802{
803 PyECB * pecb = (PyECB *) self;
804 if (!pecb || !pecb->Check()) return NULL;
805 EXTENSION_CONTROL_BLOCK *ecb = pecb->m_pcb->GetECB();
806
807 PyObject *obCallback;
808 PyObject *obArg = NULL;
809 if (!PyArg_ParseTuple(args, "O|O:IOCompletion",
810 &obCallback, // @pyparm callable|func||The function to call, as described by the <om EXTENSION_CONTROL_BLOCK.IOCallback> method.
811 &obArg)) // @pyparm object|arg|None|Any object which will be supplied as an argument to the callback function.
812 return NULL;
813
814 if (!PyCallable_Check(obCallback))
815 return PyErr_Format(PyExc_TypeError, "first param must be callable");
816 // now we have checked the params just ignore them! Stick args itself
817 // in our map.
818 if (!SetupIOCallback(ecb, args))
819 return NULL;
820
821 BOOL bRes;
822 Py_BEGIN_ALLOW_THREADS
823 bRes = ecb->ServerSupportFunction(ecb->ConnID, HSE_REQ_IO_COMPLETION, DoIOCallback, NULL, NULL);
824 Py_END_ALLOW_THREADS
825 if (!bRes)
826 return SetPyECBError("ServerSupportFunction(HSE_REQ_IO_COMPLETION)");
827 Py_RETURN_NONE;
828}
829
830// @pymethod int|EXTENSION_CONTROL_BLOCK|ReportUnhealthy|Calls ServerSupportFunction with HSE_REQ_REPORT_UNHEALTHY
831PyObject * PyECB::ReportUnhealthy(PyObject *self, PyObject *args)

Callers 1

DispatchMethod · 0.80

Calls 5

SetupIOCallbackFunction · 0.85
SetPyECBErrorFunction · 0.85
GetECBMethod · 0.80
ServerSupportFunctionMethod · 0.80
CheckMethod · 0.45

Tested by

no test coverage detected