1
/* Generated by Pyrex 0.9.6.4 on Tue Mar 18 10:18:51 2008 */
3
#define PY_SSIZE_T_CLEAN
5
#include "structmember.h"
7
#define PY_LONG_LONG LONG_LONG
9
#if PY_VERSION_HEX < 0x02050000
10
typedef int Py_ssize_t;
11
#define PY_SSIZE_T_MAX INT_MAX
12
#define PY_SSIZE_T_MIN INT_MIN
13
#define PyInt_FromSsize_t(z) PyInt_FromLong(z)
14
#define PyInt_AsSsize_t(o) PyInt_AsLong(o)
25
#define __PYX_EXTERN_C extern "C"
27
#define __PYX_EXTERN_C extern
36
#include "winsock_pointers.h"
39
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
40
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
42
static PyObject *__pyx_m;
43
static PyObject *__pyx_b;
44
static int __pyx_lineno;
45
static char *__pyx_filename;
46
static char **__pyx_f;
48
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
50
static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
52
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
54
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
56
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
58
static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
59
static int __Pyx_EndUnpack(PyObject *); /*proto*/
61
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
63
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
65
static void __Pyx_AddTraceback(char *funcname); /*proto*/
67
/* Declarations from iocpsupport */
69
typedef int __pyx_t_11iocpsupport_size_t;
71
typedef unsigned long __pyx_t_11iocpsupport_HANDLE;
73
typedef unsigned long __pyx_t_11iocpsupport_SOCKET;
75
typedef unsigned long __pyx_t_11iocpsupport_DWORD;
77
typedef unsigned long __pyx_t_11iocpsupport_ULONG_PTR;
79
typedef int __pyx_t_11iocpsupport_BOOL;
81
struct __pyx_t_11iocpsupport_myOVERLAPPED {
86
struct __pyx_obj_11iocpsupport_CompletionPort {
88
__pyx_t_11iocpsupport_HANDLE port;
92
static PyTypeObject *__pyx_ptype_11iocpsupport_CompletionPort = 0;
94
static unsigned long __pyx_k5;
95
static unsigned long __pyx_k6;
96
static unsigned long __pyx_k7;
97
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void); /*proto*/
98
static void __pyx_f_11iocpsupport_raise_error(int,PyObject *); /*proto*/
99
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *,int); /*proto*/
100
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *,PyObject *); /*proto*/
101
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET); /*proto*/
104
/* Implementation of iocpsupport */
106
static char __pyx_k4[] = "Failed to initialize Winsock function vectors";
108
static PyObject *__pyx_n_Event;
109
static PyObject *__pyx_n___init__;
110
static PyObject *__pyx_n_socket;
111
static PyObject *__pyx_n_ValueError;
112
static PyObject *__pyx_n_have_connectex;
114
static PyObject *__pyx_k4p;
116
static PyObject *__pyx_n_MemoryError;
118
static struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_f_11iocpsupport_makeOV(void) {
119
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_res;
120
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_r;
123
PyObject *__pyx_3 = 0;
125
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":110 */
126
__pyx_1 = PyMem_Malloc((sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED))); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
127
__pyx_v_res = ((struct __pyx_t_11iocpsupport_myOVERLAPPED *)__pyx_1);
129
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":111 */
130
__pyx_2 = (!(__pyx_v_res != 0));
132
__pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_MemoryError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
133
__Pyx_Raise(__pyx_3, 0, 0);
134
Py_DECREF(__pyx_3); __pyx_3 = 0;
135
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
140
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":113 */
141
memset(__pyx_v_res,0,(sizeof(struct __pyx_t_11iocpsupport_myOVERLAPPED)));
143
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":114 */
144
__pyx_r = __pyx_v_res;
151
__Pyx_AddTraceback("iocpsupport.makeOV");
157
static PyObject *__pyx_n_WindowsError;
159
static void __pyx_f_11iocpsupport_raise_error(int __pyx_v_err,PyObject *__pyx_v_message) {
161
PyObject *__pyx_2 = 0;
162
PyObject *__pyx_3 = 0;
163
PyObject *__pyx_4 = 0;
164
Py_INCREF(__pyx_v_message);
166
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":117 */
167
__pyx_1 = (!__pyx_v_err);
169
__pyx_v_err = GetLastError();
174
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":119 */
175
__pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_WindowsError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
176
__pyx_3 = PyInt_FromLong(__pyx_v_err); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
177
__pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
178
Py_INCREF(__pyx_v_message);
179
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_message);
180
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
182
__pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
183
Py_DECREF(__pyx_2); __pyx_2 = 0;
184
Py_DECREF(__pyx_4); __pyx_4 = 0;
185
__Pyx_Raise(__pyx_3, 0, 0);
186
Py_DECREF(__pyx_3); __pyx_3 = 0;
187
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
194
__Pyx_AddTraceback("iocpsupport.raise_error");
196
Py_DECREF(__pyx_v_message);
199
static PyObject *__pyx_n_callback;
200
static PyObject *__pyx_n_owner;
201
static PyObject *__pyx_n_False;
202
static PyObject *__pyx_n_ignore;
203
static PyObject *__pyx_n_items;
205
static PyObject *__pyx_f_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
206
static PyMethodDef __pyx_mdef_11iocpsupport_5Event___init__ = {"__init__", (PyCFunction)__pyx_f_11iocpsupport_5Event___init__, METH_VARARGS|METH_KEYWORDS, 0};
207
static PyObject *__pyx_f_11iocpsupport_5Event___init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
208
PyObject *__pyx_v_self = 0;
209
PyObject *__pyx_v_callback = 0;
210
PyObject *__pyx_v_owner = 0;
211
PyObject *__pyx_v_kw = 0;
215
PyObject *__pyx_1 = 0;
216
PyObject *__pyx_2 = 0;
217
PyObject *__pyx_3 = 0;
219
static char *__pyx_argnames[] = {"self","callback","owner",0};
220
if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 3, 0, &__pyx_v_kw, 0) < 0) return 0;
221
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_self, &__pyx_v_callback, &__pyx_v_owner)) {
222
Py_XDECREF(__pyx_args);
223
Py_XDECREF(__pyx_kwds);
224
Py_XDECREF(__pyx_v_kw);
227
Py_INCREF(__pyx_v_self);
228
Py_INCREF(__pyx_v_callback);
229
Py_INCREF(__pyx_v_owner);
230
__pyx_v_k = Py_None; Py_INCREF(Py_None);
231
__pyx_v_v = Py_None; Py_INCREF(Py_None);
233
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":123 */
234
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_callback, __pyx_v_callback) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
236
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":124 */
237
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_owner, __pyx_v_owner) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
239
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":125 */
240
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_False); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
241
if (PyObject_SetAttr(__pyx_v_self, __pyx_n_ignore, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; goto __pyx_L1;}
242
Py_DECREF(__pyx_1); __pyx_1 = 0;
244
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":126 */
245
__pyx_1 = PyObject_GetAttr(__pyx_v_kw, __pyx_n_items); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
246
__pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
247
Py_DECREF(__pyx_1); __pyx_1 = 0;
248
__pyx_1 = PyObject_GetIter(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
249
Py_DECREF(__pyx_2); __pyx_2 = 0;
251
__pyx_2 = PyIter_Next(__pyx_1);
253
if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
256
__pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
257
Py_DECREF(__pyx_2); __pyx_2 = 0;
258
__pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
259
Py_DECREF(__pyx_v_k);
262
__pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
263
Py_DECREF(__pyx_v_v);
266
if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
267
Py_DECREF(__pyx_3); __pyx_3 = 0;
268
__pyx_4 = PyObject_SetAttr(__pyx_v_self,__pyx_v_k,__pyx_v_v); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
270
Py_DECREF(__pyx_1); __pyx_1 = 0;
272
__pyx_r = Py_None; Py_INCREF(Py_None);
278
__Pyx_AddTraceback("iocpsupport.Event.__init__");
281
Py_XDECREF(__pyx_v_kw);
282
Py_DECREF(__pyx_v_k);
283
Py_DECREF(__pyx_v_v);
284
Py_DECREF(__pyx_v_self);
285
Py_DECREF(__pyx_v_callback);
286
Py_DECREF(__pyx_v_owner);
287
Py_XDECREF(__pyx_args);
288
Py_XDECREF(__pyx_kwds);
292
static PyObject *__pyx_n_CreateIoCompletionPort;
295
static int __pyx_f_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
296
static int __pyx_f_11iocpsupport_14CompletionPort___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
297
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
300
static char *__pyx_argnames[] = {0};
301
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
302
Py_INCREF(__pyx_v_self);
304
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":133 */
305
__pyx_v_res = CreateIoCompletionPort(INVALID_HANDLE_VALUE,0,0,0);
307
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":134 */
308
__pyx_1 = (!__pyx_v_res);
310
__pyx_f_11iocpsupport_raise_error(0,__pyx_n_CreateIoCompletionPort); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; goto __pyx_L1;}
315
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":136 */
316
((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port = __pyx_v_res;
321
__Pyx_AddTraceback("iocpsupport.CompletionPort.__init__");
324
Py_DECREF(__pyx_v_self);
329
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
330
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_addHandle(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
333
__pyx_t_11iocpsupport_HANDLE __pyx_v_res;
336
static char *__pyx_argnames[] = {"handle","key",0};
337
__pyx_v_key = __pyx_k2;
338
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "l|l", __pyx_argnames, &__pyx_v_handle, &__pyx_v_key)) return 0;
339
Py_INCREF(__pyx_v_self);
341
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":140 */
342
__pyx_v_res = CreateIoCompletionPort(__pyx_v_handle,((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port,__pyx_v_key,0);
344
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":141 */
345
__pyx_1 = (!__pyx_v_res);
347
__pyx_f_11iocpsupport_raise_error(0,__pyx_n_CreateIoCompletionPort); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
352
__pyx_r = Py_None; Py_INCREF(Py_None);
355
__Pyx_AddTraceback("iocpsupport.CompletionPort.addHandle");
358
Py_DECREF(__pyx_v_self);
362
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
363
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_getEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
364
long __pyx_v_timeout;
365
struct PyThreadState *__pyx_v__save;
366
unsigned long __pyx_v_bytes;
367
unsigned long __pyx_v_key;
368
unsigned long __pyx_v_rc;
369
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
370
PyObject *__pyx_v_obj;
373
PyObject *__pyx_2 = 0;
374
PyObject *__pyx_3 = 0;
375
PyObject *__pyx_4 = 0;
376
PyObject *__pyx_5 = 0;
377
static char *__pyx_argnames[] = {"timeout",0};
378
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "l", __pyx_argnames, &__pyx_v_timeout)) return 0;
379
Py_INCREF(__pyx_v_self);
380
__pyx_v_obj = Py_None; Py_INCREF(Py_None);
382
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":149 */
383
__pyx_v__save = PyEval_SaveThread();
385
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":150 */
386
__pyx_v_rc = GetQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port,(&__pyx_v_bytes),(&__pyx_v_key),((OVERLAPPED **)(&__pyx_v_ov)),__pyx_v_timeout);
388
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":151 */
389
PyEval_RestoreThread(__pyx_v__save);
391
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":153 */
392
__pyx_1 = (!__pyx_v_rc);
394
__pyx_v_rc = GetLastError();
402
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":158 */
404
Py_DECREF(__pyx_v_obj);
405
__pyx_v_obj = Py_None;
407
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":159 */
408
__pyx_1 = (__pyx_v_ov != 0);
411
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":160 */
412
__pyx_1 = (__pyx_v_ov->obj != 0);
415
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":161 */
416
__pyx_2 = (PyObject *)__pyx_v_ov->obj;
418
Py_DECREF(__pyx_v_obj);
419
__pyx_v_obj = __pyx_2;
422
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":162 */
423
Py_DECREF(__pyx_v_obj);
428
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":163 */
429
PyMem_Free(__pyx_v_ov);
434
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":165 */
435
__pyx_2 = PyLong_FromUnsignedLong(__pyx_v_rc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
436
__pyx_3 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
437
__pyx_4 = PyLong_FromUnsignedLong(__pyx_v_key); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
438
__pyx_5 = PyTuple_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; goto __pyx_L1;}
439
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
440
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
441
PyTuple_SET_ITEM(__pyx_5, 2, __pyx_4);
442
Py_INCREF(__pyx_v_obj);
443
PyTuple_SET_ITEM(__pyx_5, 3, __pyx_v_obj);
451
__pyx_r = Py_None; Py_INCREF(Py_None);
458
__Pyx_AddTraceback("iocpsupport.CompletionPort.getEvent");
461
Py_DECREF(__pyx_v_obj);
462
Py_DECREF(__pyx_v_self);
466
static PyObject *__pyx_n_PostQueuedCompletionStatus;
469
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
470
static PyObject *__pyx_f_11iocpsupport_14CompletionPort_postEvent(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
471
unsigned long __pyx_v_bytes;
472
unsigned long __pyx_v_key;
473
PyObject *__pyx_v_obj = 0;
474
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
475
unsigned long __pyx_v_rc;
478
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_2;
479
static char *__pyx_argnames[] = {"bytes","key","obj",0};
480
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "kkO", __pyx_argnames, &__pyx_v_bytes, &__pyx_v_key, &__pyx_v_obj)) return 0;
481
Py_INCREF(__pyx_v_self);
482
Py_INCREF(__pyx_v_obj);
484
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":171 */
485
__pyx_1 = __pyx_v_obj != Py_None;
488
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":172 */
489
__pyx_2 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
490
__pyx_v_ov = __pyx_2;
492
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":173 */
493
Py_INCREF(__pyx_v_obj);
495
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":174 */
496
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
504
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":178 */
505
__pyx_v_rc = PostQueuedCompletionStatus(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port,__pyx_v_bytes,__pyx_v_key,((OVERLAPPED *)__pyx_v_ov));
507
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":179 */
508
__pyx_1 = (!__pyx_v_rc);
510
__pyx_f_11iocpsupport_raise_error(0,__pyx_n_PostQueuedCompletionStatus); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; goto __pyx_L1;}
515
__pyx_r = Py_None; Py_INCREF(Py_None);
518
__Pyx_AddTraceback("iocpsupport.CompletionPort.postEvent");
521
Py_DECREF(__pyx_v_self);
522
Py_DECREF(__pyx_v_obj);
526
static PyObject *__pyx_f_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
527
static PyObject *__pyx_f_11iocpsupport_14CompletionPort___del__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
529
static char *__pyx_argnames[] = {0};
530
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
531
Py_INCREF(__pyx_v_self);
532
CloseHandle(((struct __pyx_obj_11iocpsupport_CompletionPort *)__pyx_v_self)->port);
534
__pyx_r = Py_None; Py_INCREF(Py_None);
535
Py_DECREF(__pyx_v_self);
539
static PyObject *__pyx_f_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
540
static PyObject *__pyx_f_11iocpsupport_makesockaddr(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
541
PyObject *__pyx_v_buff = 0;
542
void *__pyx_v_mem_buffer;
546
PyObject *__pyx_2 = 0;
547
static char *__pyx_argnames[] = {"buff",0};
548
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_buff)) return 0;
549
Py_INCREF(__pyx_v_buff);
551
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":189 */
552
__pyx_1 = PyObject_AsReadBuffer(__pyx_v_buff,(&__pyx_v_mem_buffer),(&__pyx_v_size)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; goto __pyx_L1;}
554
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":191 */
555
__pyx_2 = __pyx_f_11iocpsupport__makesockaddr(((struct sockaddr *)__pyx_v_mem_buffer),__pyx_v_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}
560
__pyx_r = Py_None; Py_INCREF(Py_None);
564
__Pyx_AddTraceback("iocpsupport.makesockaddr");
567
Py_DECREF(__pyx_v_buff);
571
static PyObject *__pyx_f_11iocpsupport__makesockaddr(struct sockaddr *__pyx_v_addr,int __pyx_v_len) {
572
struct sockaddr_in *__pyx_v_sin;
575
PyObject *__pyx_2 = 0;
576
PyObject *__pyx_3 = 0;
577
PyObject *__pyx_4 = 0;
579
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":195 */
580
__pyx_1 = (!__pyx_v_len);
589
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":197 */
590
__pyx_1 = (__pyx_v_addr->sa_family == AF_INET);
593
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":198 */
594
__pyx_v_sin = ((struct sockaddr_in *)__pyx_v_addr);
596
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":199 */
597
__pyx_2 = PyString_FromString(inet_ntoa(__pyx_v_sin->sin_addr)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
598
__pyx_3 = PyInt_FromLong(ntohs(__pyx_v_sin->sin_port)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
599
__pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
600
PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
601
PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
610
__pyx_2 = PyString_FromStringAndSize(__pyx_v_addr->sa_data,(sizeof(__pyx_v_addr->sa_data))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; goto __pyx_L1;}
617
__pyx_r = Py_None; Py_INCREF(Py_None);
623
__Pyx_AddTraceback("iocpsupport._makesockaddr");
629
static PyObject *__pyx_k11p;
631
static char __pyx_k11[] = "invalid IP address";
633
static PyObject *__pyx_f_11iocpsupport_fillinetaddr(struct sockaddr_in *__pyx_v_dest,PyObject *__pyx_v_addr) {
635
unsigned long __pyx_v_res;
636
char *__pyx_v_hoststr;
637
PyObject *__pyx_v_host;
639
PyObject *__pyx_1 = 0;
640
PyObject *__pyx_2 = 0;
644
Py_INCREF(__pyx_v_addr);
645
__pyx_v_host = Py_None; Py_INCREF(Py_None);
647
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":207 */
648
__pyx_1 = PyObject_GetIter(__pyx_v_addr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
649
__pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
650
Py_DECREF(__pyx_v_host);
651
__pyx_v_host = __pyx_2;
653
__pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
654
__pyx_3 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
655
Py_DECREF(__pyx_2); __pyx_2 = 0;
656
__pyx_v_port = __pyx_3;
657
if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
658
Py_DECREF(__pyx_1); __pyx_1 = 0;
660
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":209 */
661
__pyx_4 = PyString_AsString(__pyx_v_host); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
662
__pyx_v_hoststr = __pyx_4;
664
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":210 */
665
__pyx_v_res = inet_addr(__pyx_v_hoststr);
667
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":211 */
668
__pyx_5 = (__pyx_v_res == INADDR_ANY);
670
__pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
671
__Pyx_Raise(__pyx_2, __pyx_k11p, 0);
672
Py_DECREF(__pyx_2); __pyx_2 = 0;
673
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
678
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":213 */
679
__pyx_v_dest->sin_addr.s_addr = __pyx_v_res;
681
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":215 */
682
__pyx_v_dest->sin_port = htons(__pyx_v_port);
684
__pyx_r = Py_None; Py_INCREF(Py_None);
689
__Pyx_AddTraceback("iocpsupport.fillinetaddr");
692
Py_DECREF(__pyx_v_host);
693
Py_DECREF(__pyx_v_addr);
697
static PyObject *__pyx_f_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
698
static PyObject *__pyx_f_11iocpsupport_AllocateReadBuffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
701
PyObject *__pyx_1 = 0;
702
static char *__pyx_argnames[] = {"size",0};
703
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "i", __pyx_argnames, &__pyx_v_size)) return 0;
704
__pyx_1 = PyBuffer_New(__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
709
__pyx_r = Py_None; Py_INCREF(Py_None);
713
__Pyx_AddTraceback("iocpsupport.AllocateReadBuffer");
719
static PyObject *__pyx_n_getsockopt;
722
static PyObject *__pyx_f_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
723
static PyObject *__pyx_f_11iocpsupport_maxAddrLen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
725
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
730
PyObject *__pyx_2 = 0;
731
static char *__pyx_argnames[] = {"s",0};
732
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "l", __pyx_argnames, &__pyx_v_s)) return 0;
734
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":224 */
735
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
737
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":225 */
738
__pyx_v_rc = getsockopt(__pyx_v_s,SOL_SOCKET,SO_PROTOCOL_INFO,((char *)(&__pyx_v_wsa_pi)),(&__pyx_v_size));
740
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":226 */
741
__pyx_1 = (__pyx_v_rc == SOCKET_ERROR);
743
__pyx_f_11iocpsupport_raise_error(WSAGetLastError(),__pyx_n_getsockopt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
748
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":228 */
749
__pyx_2 = PyInt_FromLong(__pyx_v_wsa_pi.iMaxSockAddr); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
754
__pyx_r = Py_None; Py_INCREF(Py_None);
758
__Pyx_AddTraceback("iocpsupport.maxAddrLen");
765
static int __pyx_f_11iocpsupport_getAddrFamily(__pyx_t_11iocpsupport_SOCKET __pyx_v_s) {
766
WSAPROTOCOL_INFO __pyx_v_wsa_pi;
772
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":234 */
773
__pyx_v_size = (sizeof(__pyx_v_wsa_pi));
775
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":235 */
776
__pyx_v_rc = getsockopt(__pyx_v_s,SOL_SOCKET,SO_PROTOCOL_INFO,((char *)(&__pyx_v_wsa_pi)),(&__pyx_v_size));
778
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":236 */
779
__pyx_1 = (__pyx_v_rc == SOCKET_ERROR);
781
__pyx_f_11iocpsupport_raise_error(WSAGetLastError(),__pyx_n_getsockopt); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
786
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":238 */
787
__pyx_r = __pyx_v_wsa_pi.iAddressFamily;
793
__Pyx_AddTraceback("iocpsupport.getAddrFamily");
798
static PyObject *__pyx_f_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
799
static PyObject *__pyx_f_11iocpsupport_accept(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
800
long __pyx_v_listening;
801
long __pyx_v_accepting;
802
PyObject *__pyx_v_buff = 0;
803
PyObject *__pyx_v_obj = 0;
804
unsigned long __pyx_v_bytes;
807
void *__pyx_v_mem_buffer;
808
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
811
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_2;
812
PyObject *__pyx_3 = 0;
813
static char *__pyx_argnames[] = {"listening","accepting","buff","obj",0};
814
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "llOO", __pyx_argnames, &__pyx_v_listening, &__pyx_v_accepting, &__pyx_v_buff, &__pyx_v_obj)) return 0;
815
Py_INCREF(__pyx_v_buff);
816
Py_INCREF(__pyx_v_obj);
818
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":11 */
819
__pyx_1 = PyObject_AsWriteBuffer(__pyx_v_buff,(&__pyx_v_mem_buffer),(&__pyx_v_size)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; goto __pyx_L1;}
821
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":13 */
822
__pyx_2 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; goto __pyx_L1;}
823
__pyx_v_ov = __pyx_2;
825
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":14 */
826
__pyx_1 = __pyx_v_obj != Py_None;
828
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
833
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":17 */
834
__pyx_v_rc = lpAcceptEx(__pyx_v_listening,__pyx_v_accepting,__pyx_v_mem_buffer,0,(__pyx_v_size / 2),(__pyx_v_size / 2),(&__pyx_v_bytes),((OVERLAPPED *)__pyx_v_ov));
836
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":19 */
837
__pyx_1 = (!__pyx_v_rc);
840
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":20 */
841
__pyx_v_rc = WSAGetLastError();
843
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":21 */
844
__pyx_1 = (__pyx_v_rc != ERROR_IO_PENDING);
846
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 22; goto __pyx_L1;}
857
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":25 */
858
Py_XINCREF(__pyx_v_obj);
860
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":26 */
861
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}
866
__pyx_r = Py_None; Py_INCREF(Py_None);
870
__Pyx_AddTraceback("iocpsupport.accept");
873
Py_DECREF(__pyx_v_buff);
874
Py_DECREF(__pyx_v_obj);
878
static PyObject *__pyx_f_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
879
static PyObject *__pyx_f_11iocpsupport_get_accept_addrs(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
881
PyObject *__pyx_v_buff = 0;
883
int __pyx_v_locallen;
884
int __pyx_v_remotelen;
885
void *__pyx_v_mem_buffer;
886
struct sockaddr *__pyx_v_localaddr;
887
struct sockaddr *__pyx_v_remoteaddr;
890
PyObject *__pyx_2 = 0;
891
PyObject *__pyx_3 = 0;
892
PyObject *__pyx_4 = 0;
893
PyObject *__pyx_5 = 0;
894
static char *__pyx_argnames[] = {"s","buff",0};
895
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lO", __pyx_argnames, &__pyx_v_s, &__pyx_v_buff)) return 0;
896
Py_INCREF(__pyx_v_buff);
898
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":34 */
899
__pyx_1 = PyObject_AsReadBuffer(__pyx_v_buff,(&__pyx_v_mem_buffer),(&__pyx_v_size)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; goto __pyx_L1;}
901
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":36 */
902
lpGetAcceptExSockaddrs(__pyx_v_mem_buffer,0,(__pyx_v_size / 2),(__pyx_v_size / 2),(&__pyx_v_localaddr),(&__pyx_v_locallen),(&__pyx_v_remoteaddr),(&__pyx_v_remotelen));
904
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\acceptex.pxi":37 */
905
__pyx_2 = PyInt_FromLong(__pyx_v_remoteaddr->sa_family); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; goto __pyx_L1;}
906
__pyx_3 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_localaddr,__pyx_v_locallen); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; goto __pyx_L1;}
907
__pyx_4 = __pyx_f_11iocpsupport__makesockaddr(__pyx_v_remoteaddr,__pyx_v_remotelen); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; goto __pyx_L1;}
908
__pyx_5 = PyTuple_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 37; goto __pyx_L1;}
909
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
910
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
911
PyTuple_SET_ITEM(__pyx_5, 2, __pyx_4);
919
__pyx_r = Py_None; Py_INCREF(Py_None);
926
__Pyx_AddTraceback("iocpsupport.get_accept_addrs");
929
Py_DECREF(__pyx_v_buff);
933
static PyObject *__pyx_k14p;
934
static PyObject *__pyx_k15p;
936
static char __pyx_k14[] = "ConnectEx is not available on this system";
937
static char __pyx_k15[] = "unsupported address family";
939
static PyObject *__pyx_f_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
940
static PyObject *__pyx_f_11iocpsupport_connect(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
942
PyObject *__pyx_v_addr = 0;
943
PyObject *__pyx_v_obj = 0;
946
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
947
struct sockaddr __pyx_v_name;
949
PyObject *__pyx_1 = 0;
952
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_4;
953
static char *__pyx_argnames[] = {"s","addr","obj",0};
954
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lOO", __pyx_argnames, &__pyx_v_s, &__pyx_v_addr, &__pyx_v_obj)) return 0;
955
Py_INCREF(__pyx_v_addr);
956
Py_INCREF(__pyx_v_obj);
958
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":10 */
959
__pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_have_connectex); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; goto __pyx_L1;}
960
__pyx_2 = PyObject_IsTrue(__pyx_1); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 10; goto __pyx_L1;}
961
Py_DECREF(__pyx_1); __pyx_1 = 0;
962
__pyx_3 = (!__pyx_2);
964
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; goto __pyx_L1;}
965
__Pyx_Raise(__pyx_1, __pyx_k14p, 0);
966
Py_DECREF(__pyx_1); __pyx_1 = 0;
967
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 11; goto __pyx_L1;}
972
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":13 */
973
__pyx_2 = __pyx_f_11iocpsupport_getAddrFamily(__pyx_v_s); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 13; goto __pyx_L1;}
974
__pyx_v_family = __pyx_2;
976
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":14 */
977
__pyx_3 = (__pyx_v_family == AF_INET);
979
__pyx_1 = __pyx_f_11iocpsupport_fillinetaddr(((struct sockaddr_in *)(&__pyx_v_name)),__pyx_v_addr); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 15; goto __pyx_L1;}
980
Py_DECREF(__pyx_1); __pyx_1 = 0;
984
__pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; goto __pyx_L1;}
985
__Pyx_Raise(__pyx_1, __pyx_k15p, 0);
986
Py_DECREF(__pyx_1); __pyx_1 = 0;
987
{__pyx_filename = __pyx_f[2]; __pyx_lineno = 17; goto __pyx_L1;}
991
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":18 */
992
__pyx_v_name.sa_family = __pyx_v_family;
994
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":20 */
995
__pyx_4 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 20; goto __pyx_L1;}
996
__pyx_v_ov = __pyx_4;
998
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":21 */
999
__pyx_2 = __pyx_v_obj != Py_None;
1001
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1006
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":24 */
1007
__pyx_v_rc = lpConnectEx(__pyx_v_s,(&__pyx_v_name),(sizeof(__pyx_v_name)),NULL,0,NULL,((OVERLAPPED *)__pyx_v_ov));
1009
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":26 */
1010
__pyx_3 = (!__pyx_v_rc);
1013
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":27 */
1014
__pyx_v_rc = WSAGetLastError();
1016
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":28 */
1017
__pyx_2 = (__pyx_v_rc != ERROR_IO_PENDING);
1019
__pyx_1 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 29; goto __pyx_L1;}
1030
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":32 */
1031
Py_XINCREF(__pyx_v_obj);
1033
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\connectex.pxi":33 */
1034
__pyx_1 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_1) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 33; goto __pyx_L1;}
1039
__pyx_r = Py_None; Py_INCREF(Py_None);
1042
Py_XDECREF(__pyx_1);
1043
__Pyx_AddTraceback("iocpsupport.connect");
1046
Py_DECREF(__pyx_v_addr);
1047
Py_DECREF(__pyx_v_obj);
1051
static char __pyx_k16[] = "second argument needs to be a list";
1053
static PyObject *__pyx_f_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1054
static PyObject *__pyx_f_11iocpsupport_recv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1056
PyObject *__pyx_v_bufflist = 0;
1057
PyObject *__pyx_v_obj = 0;
1058
unsigned long __pyx_v_flags;
1060
int __pyx_v_buffcount;
1062
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1063
WSABUF *__pyx_v_ws_buf;
1064
unsigned long __pyx_v_bytes;
1065
struct PyObject **__pyx_v_buffers;
1067
PyObject *__pyx_1 = 0;
1070
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_4;
1071
PyObject *__pyx_5 = 0;
1072
PyObject *__pyx_6 = 0;
1073
static char *__pyx_argnames[] = {"s","bufflist","obj","flags",0};
1074
__pyx_v_flags = __pyx_k5;
1075
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lOO|k", __pyx_argnames, &__pyx_v_s, &__pyx_v_bufflist, &__pyx_v_obj, &__pyx_v_flags)) return 0;
1076
Py_INCREF(__pyx_v_bufflist);
1077
Py_INCREF(__pyx_v_obj);
1079
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":12 */
1080
__pyx_1 = PySequence_Fast(__pyx_v_bufflist,__pyx_k16); if (!__pyx_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 12; goto __pyx_L1;}
1081
Py_DECREF(__pyx_v_bufflist);
1082
__pyx_v_bufflist = __pyx_1;
1085
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":13 */
1086
__pyx_v_buffcount = PySequence_Fast_GET_SIZE(__pyx_v_bufflist);
1088
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":14 */
1089
__pyx_v_buffers = PySequence_Fast_ITEMS(__pyx_v_bufflist);
1091
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":16 */
1092
__pyx_2 = PyMem_Malloc((__pyx_v_buffcount * (sizeof(WSABUF)))); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 16; goto __pyx_L1;}
1093
__pyx_v_ws_buf = ((WSABUF *)__pyx_2);
1095
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":18 */
1098
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":19 */
1099
for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_buffcount; ++__pyx_v_i) {
1100
__pyx_1 = (PyObject *)(__pyx_v_buffers[__pyx_v_i]);
1102
__pyx_3 = PyObject_AsWriteBuffer(__pyx_1,((void **)(&(__pyx_v_ws_buf[__pyx_v_i]).buf)),((int *)(&(__pyx_v_ws_buf[__pyx_v_i]).len))); if (__pyx_3 == (-1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 20; goto __pyx_L3;}
1103
Py_DECREF(__pyx_1); __pyx_1 = 0;
1106
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":22 */
1107
__pyx_4 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 22; goto __pyx_L3;}
1108
__pyx_v_ov = __pyx_4;
1110
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":23 */
1111
__pyx_3 = __pyx_v_obj != Py_None;
1113
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1118
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":26 */
1119
__pyx_v_rc = WSARecv(__pyx_v_s,__pyx_v_ws_buf,__pyx_v_buffcount,(&__pyx_v_bytes),(&__pyx_v_flags),((OVERLAPPED *)__pyx_v_ov),NULL);
1121
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":28 */
1122
__pyx_3 = (__pyx_v_rc == SOCKET_ERROR);
1125
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":29 */
1126
__pyx_v_rc = WSAGetLastError();
1128
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":30 */
1129
__pyx_3 = (__pyx_v_rc != ERROR_IO_PENDING);
1131
__pyx_1 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; goto __pyx_L3;}
1132
__pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; goto __pyx_L3;}
1133
__pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 31; goto __pyx_L3;}
1134
PyTuple_SET_ITEM(__pyx_6, 0, __pyx_1);
1135
PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
1148
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":33 */
1149
Py_XINCREF(__pyx_v_obj);
1151
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":34 */
1152
__pyx_1 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_1) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; goto __pyx_L3;}
1153
__pyx_5 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (!__pyx_5) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; goto __pyx_L3;}
1154
__pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 34; goto __pyx_L3;}
1155
PyTuple_SET_ITEM(__pyx_6, 0, __pyx_1);
1156
PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
1165
PyObject *__pyx_exc_type, *__pyx_exc_value, *__pyx_exc_tb;
1166
int __pyx_exc_lineno;
1167
__pyx_why = 0; goto __pyx_L4;
1168
__pyx_L2: __pyx_why = 3; goto __pyx_L4;
1171
Py_XDECREF(__pyx_1); __pyx_1 = 0;
1172
Py_XDECREF(__pyx_5); __pyx_5 = 0;
1173
Py_XDECREF(__pyx_6); __pyx_6 = 0;
1174
PyErr_Fetch(&__pyx_exc_type, &__pyx_exc_value, &__pyx_exc_tb);
1175
__pyx_exc_lineno = __pyx_lineno;
1179
PyMem_Free(__pyx_v_ws_buf);
1180
switch (__pyx_why) {
1181
case 3: goto __pyx_L0;
1183
PyErr_Restore(__pyx_exc_type, __pyx_exc_value, __pyx_exc_tb);
1184
__pyx_lineno = __pyx_exc_lineno;
1186
__pyx_exc_value = 0;
1193
__pyx_r = Py_None; Py_INCREF(Py_None);
1196
Py_XDECREF(__pyx_1);
1197
Py_XDECREF(__pyx_5);
1198
Py_XDECREF(__pyx_6);
1199
__Pyx_AddTraceback("iocpsupport.recv");
1202
Py_DECREF(__pyx_v_bufflist);
1203
Py_DECREF(__pyx_v_obj);
1207
static PyObject *__pyx_f_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1208
static PyObject *__pyx_f_11iocpsupport_recvfrom(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1210
PyObject *__pyx_v_buff = 0;
1211
PyObject *__pyx_v_addr_buff = 0;
1212
PyObject *__pyx_v_obj = 0;
1213
unsigned long __pyx_v_flags;
1215
int __pyx_v_fromlen;
1216
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1217
WSABUF __pyx_v_ws_buf;
1218
unsigned long __pyx_v_bytes;
1219
struct sockaddr *__pyx_v_fromaddr;
1222
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_2;
1223
PyObject *__pyx_3 = 0;
1224
PyObject *__pyx_4 = 0;
1225
PyObject *__pyx_5 = 0;
1226
static char *__pyx_argnames[] = {"s","buff","addr_buff","obj","flags",0};
1227
__pyx_v_flags = __pyx_k6;
1228
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lOOO|k", __pyx_argnames, &__pyx_v_s, &__pyx_v_buff, &__pyx_v_addr_buff, &__pyx_v_obj, &__pyx_v_flags)) return 0;
1229
Py_INCREF(__pyx_v_buff);
1230
Py_INCREF(__pyx_v_addr_buff);
1231
Py_INCREF(__pyx_v_obj);
1233
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":45 */
1234
__pyx_1 = PyObject_AsWriteBuffer(__pyx_v_buff,((void **)(&__pyx_v_ws_buf.buf)),((int *)(&__pyx_v_ws_buf.len))); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 45; goto __pyx_L1;}
1236
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":46 */
1237
__pyx_1 = PyObject_AsWriteBuffer(__pyx_v_addr_buff,((void **)(&__pyx_v_fromaddr)),(&__pyx_v_fromlen)); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 46; goto __pyx_L1;}
1239
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":48 */
1240
__pyx_2 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 48; goto __pyx_L1;}
1241
__pyx_v_ov = __pyx_2;
1243
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":49 */
1244
__pyx_1 = __pyx_v_obj != Py_None;
1246
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1251
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":52 */
1252
__pyx_v_rc = WSARecvFrom(__pyx_v_s,(&__pyx_v_ws_buf),1,(&__pyx_v_bytes),(&__pyx_v_flags),__pyx_v_fromaddr,(&__pyx_v_fromlen),((OVERLAPPED *)__pyx_v_ov),NULL);
1254
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":54 */
1255
__pyx_1 = (__pyx_v_rc == SOCKET_ERROR);
1258
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":55 */
1259
__pyx_v_rc = WSAGetLastError();
1261
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":56 */
1262
__pyx_1 = (__pyx_v_rc != ERROR_IO_PENDING);
1264
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; goto __pyx_L1;}
1265
__pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; goto __pyx_L1;}
1266
__pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 57; goto __pyx_L1;}
1267
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
1268
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
1281
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":59 */
1282
Py_XINCREF(__pyx_v_obj);
1284
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":60 */
1285
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; goto __pyx_L1;}
1286
__pyx_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (!__pyx_4) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; goto __pyx_L1;}
1287
__pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 60; goto __pyx_L1;}
1288
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
1289
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
1296
__pyx_r = Py_None; Py_INCREF(Py_None);
1299
Py_XDECREF(__pyx_3);
1300
Py_XDECREF(__pyx_4);
1301
Py_XDECREF(__pyx_5);
1302
__Pyx_AddTraceback("iocpsupport.recvfrom");
1305
Py_DECREF(__pyx_v_buff);
1306
Py_DECREF(__pyx_v_addr_buff);
1307
Py_DECREF(__pyx_v_obj);
1311
static PyObject *__pyx_f_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1312
static PyObject *__pyx_f_11iocpsupport_send(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1314
PyObject *__pyx_v_buff = 0;
1315
PyObject *__pyx_v_obj = 0;
1316
unsigned long __pyx_v_flags;
1318
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_v_ov;
1319
WSABUF __pyx_v_ws_buf;
1320
unsigned long __pyx_v_bytes;
1323
struct __pyx_t_11iocpsupport_myOVERLAPPED *__pyx_2;
1324
PyObject *__pyx_3 = 0;
1325
PyObject *__pyx_4 = 0;
1326
PyObject *__pyx_5 = 0;
1327
static char *__pyx_argnames[] = {"s","buff","obj","flags",0};
1328
__pyx_v_flags = __pyx_k7;
1329
if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "lOO|k", __pyx_argnames, &__pyx_v_s, &__pyx_v_buff, &__pyx_v_obj, &__pyx_v_flags)) return 0;
1330
Py_INCREF(__pyx_v_buff);
1331
Py_INCREF(__pyx_v_obj);
1333
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":11 */
1334
__pyx_1 = PyObject_AsReadBuffer(__pyx_v_buff,((void **)(&__pyx_v_ws_buf.buf)),((int *)(&__pyx_v_ws_buf.len))); if (__pyx_1 == (-1)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 11; goto __pyx_L1;}
1336
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":13 */
1337
__pyx_2 = __pyx_f_11iocpsupport_makeOV(); if (__pyx_2 == NULL) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 13; goto __pyx_L1;}
1338
__pyx_v_ov = __pyx_2;
1340
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":14 */
1341
__pyx_1 = __pyx_v_obj != Py_None;
1343
__pyx_v_ov->obj = ((struct PyObject *)__pyx_v_obj);
1348
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":17 */
1349
__pyx_v_rc = WSASend(__pyx_v_s,(&__pyx_v_ws_buf),1,(&__pyx_v_bytes),__pyx_v_flags,((OVERLAPPED *)__pyx_v_ov),NULL);
1351
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":19 */
1352
__pyx_1 = (__pyx_v_rc == SOCKET_ERROR);
1355
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":20 */
1356
__pyx_v_rc = WSAGetLastError();
1358
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":21 */
1359
__pyx_1 = (__pyx_v_rc != ERROR_IO_PENDING);
1361
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; goto __pyx_L1;}
1362
__pyx_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (!__pyx_4) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; goto __pyx_L1;}
1363
__pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 22; goto __pyx_L1;}
1364
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
1365
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
1378
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":24 */
1379
Py_XINCREF(__pyx_v_obj);
1381
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":25 */
1382
__pyx_3 = PyInt_FromLong(__pyx_v_rc); if (!__pyx_3) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; goto __pyx_L1;}
1383
__pyx_4 = PyLong_FromUnsignedLong(__pyx_v_bytes); if (!__pyx_4) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; goto __pyx_L1;}
1384
__pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; goto __pyx_L1;}
1385
PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
1386
PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
1393
__pyx_r = Py_None; Py_INCREF(Py_None);
1396
Py_XDECREF(__pyx_3);
1397
Py_XDECREF(__pyx_4);
1398
Py_XDECREF(__pyx_5);
1399
__Pyx_AddTraceback("iocpsupport.send");
1402
Py_DECREF(__pyx_v_buff);
1403
Py_DECREF(__pyx_v_obj);
1407
static __Pyx_InternTabEntry __pyx_intern_tab[] = {
1408
{&__pyx_n_CreateIoCompletionPort, "CreateIoCompletionPort"},
1409
{&__pyx_n_Event, "Event"},
1410
{&__pyx_n_False, "False"},
1411
{&__pyx_n_MemoryError, "MemoryError"},
1412
{&__pyx_n_PostQueuedCompletionStatus, "PostQueuedCompletionStatus"},
1413
{&__pyx_n_ValueError, "ValueError"},
1414
{&__pyx_n_WindowsError, "WindowsError"},
1415
{&__pyx_n___init__, "__init__"},
1416
{&__pyx_n_callback, "callback"},
1417
{&__pyx_n_getsockopt, "getsockopt"},
1418
{&__pyx_n_have_connectex, "have_connectex"},
1419
{&__pyx_n_ignore, "ignore"},
1420
{&__pyx_n_items, "items"},
1421
{&__pyx_n_owner, "owner"},
1422
{&__pyx_n_socket, "socket"},
1426
static __Pyx_StringTabEntry __pyx_string_tab[] = {
1427
{&__pyx_k4p, __pyx_k4, sizeof(__pyx_k4)},
1428
{&__pyx_k11p, __pyx_k11, sizeof(__pyx_k11)},
1429
{&__pyx_k14p, __pyx_k14, sizeof(__pyx_k14)},
1430
{&__pyx_k15p, __pyx_k15, sizeof(__pyx_k15)},
1434
static PyObject *__pyx_tp_new_11iocpsupport_CompletionPort(PyTypeObject *t, PyObject *a, PyObject *k) {
1435
PyObject *o = (*t->tp_alloc)(t, 0);
1440
static void __pyx_tp_dealloc_11iocpsupport_CompletionPort(PyObject *o) {
1441
(*o->ob_type->tp_free)(o);
1444
static int __pyx_tp_traverse_11iocpsupport_CompletionPort(PyObject *o, visitproc v, void *a) {
1448
static int __pyx_tp_clear_11iocpsupport_CompletionPort(PyObject *o) {
1452
static struct PyMethodDef __pyx_methods_11iocpsupport_CompletionPort[] = {
1453
{"addHandle", (PyCFunction)__pyx_f_11iocpsupport_14CompletionPort_addHandle, METH_VARARGS|METH_KEYWORDS, 0},
1454
{"getEvent", (PyCFunction)__pyx_f_11iocpsupport_14CompletionPort_getEvent, METH_VARARGS|METH_KEYWORDS, 0},
1455
{"postEvent", (PyCFunction)__pyx_f_11iocpsupport_14CompletionPort_postEvent, METH_VARARGS|METH_KEYWORDS, 0},
1456
{"__del__", (PyCFunction)__pyx_f_11iocpsupport_14CompletionPort___del__, METH_VARARGS|METH_KEYWORDS, 0},
1460
static PyNumberMethods __pyx_tp_as_number_CompletionPort = {
1484
0, /*nb_inplace_add*/
1485
0, /*nb_inplace_subtract*/
1486
0, /*nb_inplace_multiply*/
1487
0, /*nb_inplace_divide*/
1488
0, /*nb_inplace_remainder*/
1489
0, /*nb_inplace_power*/
1490
0, /*nb_inplace_lshift*/
1491
0, /*nb_inplace_rshift*/
1492
0, /*nb_inplace_and*/
1493
0, /*nb_inplace_xor*/
1494
0, /*nb_inplace_or*/
1495
0, /*nb_floor_divide*/
1496
0, /*nb_true_divide*/
1497
0, /*nb_inplace_floor_divide*/
1498
0, /*nb_inplace_true_divide*/
1499
#if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
1504
static PySequenceMethods __pyx_tp_as_sequence_CompletionPort = {
1513
0, /*sq_inplace_concat*/
1514
0, /*sq_inplace_repeat*/
1517
static PyMappingMethods __pyx_tp_as_mapping_CompletionPort = {
1520
0, /*mp_ass_subscript*/
1523
static PyBufferProcs __pyx_tp_as_buffer_CompletionPort = {
1524
0, /*bf_getreadbuffer*/
1525
0, /*bf_getwritebuffer*/
1526
0, /*bf_getsegcount*/
1527
0, /*bf_getcharbuffer*/
1530
PyTypeObject __pyx_type_11iocpsupport_CompletionPort = {
1531
PyObject_HEAD_INIT(0)
1533
"iocpsupport.CompletionPort", /*tp_name*/
1534
sizeof(struct __pyx_obj_11iocpsupport_CompletionPort), /*tp_basicsize*/
1536
__pyx_tp_dealloc_11iocpsupport_CompletionPort, /*tp_dealloc*/
1542
&__pyx_tp_as_number_CompletionPort, /*tp_as_number*/
1543
&__pyx_tp_as_sequence_CompletionPort, /*tp_as_sequence*/
1544
&__pyx_tp_as_mapping_CompletionPort, /*tp_as_mapping*/
1550
&__pyx_tp_as_buffer_CompletionPort, /*tp_as_buffer*/
1551
Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
1553
__pyx_tp_traverse_11iocpsupport_CompletionPort, /*tp_traverse*/
1554
__pyx_tp_clear_11iocpsupport_CompletionPort, /*tp_clear*/
1555
0, /*tp_richcompare*/
1556
0, /*tp_weaklistoffset*/
1559
__pyx_methods_11iocpsupport_CompletionPort, /*tp_methods*/
1566
0, /*tp_dictoffset*/
1567
__pyx_f_11iocpsupport_14CompletionPort___init__, /*tp_init*/
1569
__pyx_tp_new_11iocpsupport_CompletionPort, /*tp_new*/
1575
0, /*tp_subclasses*/
1579
static struct PyMethodDef __pyx_methods[] = {
1580
{"makesockaddr", (PyCFunction)__pyx_f_11iocpsupport_makesockaddr, METH_VARARGS|METH_KEYWORDS, 0},
1581
{"AllocateReadBuffer", (PyCFunction)__pyx_f_11iocpsupport_AllocateReadBuffer, METH_VARARGS|METH_KEYWORDS, 0},
1582
{"maxAddrLen", (PyCFunction)__pyx_f_11iocpsupport_maxAddrLen, METH_VARARGS|METH_KEYWORDS, 0},
1583
{"accept", (PyCFunction)__pyx_f_11iocpsupport_accept, METH_VARARGS|METH_KEYWORDS, 0},
1584
{"get_accept_addrs", (PyCFunction)__pyx_f_11iocpsupport_get_accept_addrs, METH_VARARGS|METH_KEYWORDS, 0},
1585
{"connect", (PyCFunction)__pyx_f_11iocpsupport_connect, METH_VARARGS|METH_KEYWORDS, 0},
1586
{"recv", (PyCFunction)__pyx_f_11iocpsupport_recv, METH_VARARGS|METH_KEYWORDS, 0},
1587
{"recvfrom", (PyCFunction)__pyx_f_11iocpsupport_recvfrom, METH_VARARGS|METH_KEYWORDS, 0},
1588
{"send", (PyCFunction)__pyx_f_11iocpsupport_send, METH_VARARGS|METH_KEYWORDS, 0},
1592
static void __pyx_init_filenames(void); /*proto*/
1594
PyMODINIT_FUNC initiocpsupport(void); /*proto*/
1595
PyMODINIT_FUNC initiocpsupport(void) {
1596
PyObject *__pyx_1 = 0;
1597
PyObject *__pyx_2 = 0;
1598
PyObject *__pyx_3 = 0;
1599
PyObject *__pyx_4 = 0;
1601
__pyx_init_filenames();
1602
__pyx_m = Py_InitModule4("iocpsupport", __pyx_methods, 0, 0, PYTHON_API_VERSION);
1603
if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;};
1605
__pyx_b = PyImport_AddModule("__builtin__");
1606
if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;};
1607
if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;};
1608
if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;};
1609
if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;};
1610
if (PyType_Ready(&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
1611
if (PyObject_SetAttrString(__pyx_m, "CompletionPort", (PyObject *)&__pyx_type_11iocpsupport_CompletionPort) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
1612
__pyx_ptype_11iocpsupport_CompletionPort = &__pyx_type_11iocpsupport_CompletionPort;
1614
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":121 */
1615
__pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
1616
__pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
1617
__pyx_3 = __Pyx_CreateClass(__pyx_2, __pyx_1, __pyx_n_Event, "iocpsupport"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
1618
Py_DECREF(__pyx_2); __pyx_2 = 0;
1619
__pyx_2 = PyCFunction_New(&__pyx_mdef_11iocpsupport_5Event___init__, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
1620
__pyx_4 = PyMethod_New(__pyx_2, 0, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
1621
Py_DECREF(__pyx_2); __pyx_2 = 0;
1622
if (PyObject_SetAttr(__pyx_3, __pyx_n___init__, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; goto __pyx_L1;}
1623
Py_DECREF(__pyx_4); __pyx_4 = 0;
1624
if (PyObject_SetAttr(__pyx_m, __pyx_n_Event, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
1625
Py_DECREF(__pyx_3); __pyx_3 = 0;
1626
Py_DECREF(__pyx_1); __pyx_1 = 0;
1628
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":138 */
1631
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":240 */
1632
__pyx_2 = __Pyx_Import(__pyx_n_socket, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
1633
if (PyObject_SetAttr(__pyx_m, __pyx_n_socket, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; goto __pyx_L1;}
1634
Py_DECREF(__pyx_2); __pyx_2 = 0;
1636
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":241 */
1637
__pyx_5 = (!initWinsockPointers());
1639
__pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}
1640
__Pyx_Raise(__pyx_4, __pyx_k4p, 0);
1641
Py_DECREF(__pyx_4); __pyx_4 = 0;
1642
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; goto __pyx_L1;}
1647
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport/iocpsupport.pyx":244 */
1648
__pyx_3 = PyInt_FromLong((lpConnectEx != NULL)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
1649
if (PyObject_SetAttr(__pyx_m, __pyx_n_have_connectex, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; goto __pyx_L1;}
1650
Py_DECREF(__pyx_3); __pyx_3 = 0;
1652
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":5 */
1655
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsarecv.pxi":38 */
1658
/* "X:\projects\Twisted\trunk\twisted\internet\iocpreactor\iocpsupport\wsasend.pxi":5 */
1662
Py_XDECREF(__pyx_1);
1663
Py_XDECREF(__pyx_2);
1664
Py_XDECREF(__pyx_3);
1665
Py_XDECREF(__pyx_4);
1666
__Pyx_AddTraceback("iocpsupport");
1669
static char *__pyx_filenames[] = {
1677
/* Runtime support code */
1679
static void __pyx_init_filenames(void) {
1680
__pyx_f = __pyx_filenames;
1683
static PyObject *__Pyx_CreateClass(
1684
PyObject *bases, PyObject *dict, PyObject *name, char *modname)
1686
PyObject *py_modname;
1687
PyObject *result = 0;
1689
py_modname = PyString_FromString(modname);
1692
if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
1694
result = PyClass_New(bases, dict, name);
1696
Py_XDECREF(py_modname);
1700
static int __Pyx_GetStarArgs(
1709
PyObject *x = 0, *args1 = 0, *kwds1 = 0;
1719
args1 = PyTuple_GetSlice(*args, 0, nargs);
1722
*args2 = PyTuple_GetSlice(*args, nargs, PyTuple_GET_SIZE(*args));
1726
else if (PyTuple_GET_SIZE(*args) > nargs) {
1728
int n = PyTuple_GET_SIZE(*args);
1729
PyErr_Format(PyExc_TypeError,
1730
"function takes at most %d positional arguments (%d given)",
1739
if (rqd_kwds && !*kwds)
1740
for (i = 0, p = kwd_list; *p; i++, p++)
1746
kwds1 = PyDict_New();
1749
*kwds2 = PyDict_Copy(*kwds);
1752
for (i = 0, p = kwd_list; *p; i++, p++) {
1753
x = PyDict_GetItemString(*kwds, *p);
1755
if (PyDict_SetItemString(kwds1, *p, x) < 0)
1757
if (PyDict_DelItemString(*kwds2, *p) < 0)
1760
else if (rqd_kwds && rqd_kwds[i])
1765
*kwds2 = PyDict_New();
1773
if (rqd_kwds && *kwds)
1774
for (i = 0, p = kwd_list; *p; i++, p++)
1775
if (rqd_kwds[i] && !PyDict_GetItemString(*kwds, *p))
1783
PyErr_Format(PyExc_TypeError,
1784
"required keyword argument '%s' is missing", *p);
1797
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
1798
PyObject *__import__ = 0;
1799
PyObject *empty_list = 0;
1800
PyObject *module = 0;
1801
PyObject *global_dict = 0;
1802
PyObject *empty_dict = 0;
1804
__import__ = PyObject_GetAttrString(__pyx_b, "__import__");
1810
empty_list = PyList_New(0);
1815
global_dict = PyModule_GetDict(__pyx_m);
1818
empty_dict = PyDict_New();
1821
module = PyObject_CallFunction(__import__, "OOOO",
1822
name, global_dict, empty_dict, list);
1824
Py_XDECREF(empty_list);
1825
Py_XDECREF(__import__);
1826
Py_XDECREF(empty_dict);
1830
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
1832
result = PyObject_GetAttr(dict, name);
1834
PyErr_SetObject(PyExc_NameError, name);
1838
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
1842
/* First, check the traceback argument, replacing None with NULL. */
1843
if (tb == Py_None) {
1847
else if (tb != NULL && !PyTraceBack_Check(tb)) {
1848
PyErr_SetString(PyExc_TypeError,
1849
"raise: arg 3 must be a traceback or None");
1852
/* Next, replace a missing value with None */
1853
if (value == NULL) {
1857
#if PY_VERSION_HEX < 0x02050000
1858
if (!PyClass_Check(type))
1860
if (!PyType_Check(type))
1863
/* Raising an instance. The value should be a dummy. */
1864
if (value != Py_None) {
1865
PyErr_SetString(PyExc_TypeError,
1866
"instance exception may not have a separate value");
1869
/* Normalize to raise <class>, <instance> */
1872
#if PY_VERSION_HEX < 0x02050000
1873
if (PyInstance_Check(type)) {
1874
type = (PyObject*) ((PyInstanceObject*)type)->in_class;
1878
PyErr_SetString(PyExc_TypeError,
1879
"raise: exception must be an old-style class or instance");
1883
type = (PyObject*) type->ob_type;
1885
if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
1886
PyErr_SetString(PyExc_TypeError,
1887
"raise: exception class must be a subclass of BaseException");
1892
PyErr_Restore(type, value, tb);
1901
static void __Pyx_UnpackError(void) {
1902
PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
1905
static PyObject *__Pyx_UnpackItem(PyObject *iter) {
1907
if (!(item = PyIter_Next(iter))) {
1908
if (!PyErr_Occurred())
1909
__Pyx_UnpackError();
1914
static int __Pyx_EndUnpack(PyObject *iter) {
1916
if ((item = PyIter_Next(iter))) {
1918
__Pyx_UnpackError();
1921
else if (!PyErr_Occurred())
1927
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
1929
*t->p = PyString_InternFromString(t->s);
1937
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
1939
*t->p = PyString_FromStringAndSize(t->s, t->n - 1);
1947
#include "compile.h"
1948
#include "frameobject.h"
1949
#include "traceback.h"
1951
static void __Pyx_AddTraceback(char *funcname) {
1952
PyObject *py_srcfile = 0;
1953
PyObject *py_funcname = 0;
1954
PyObject *py_globals = 0;
1955
PyObject *empty_tuple = 0;
1956
PyObject *empty_string = 0;
1957
PyCodeObject *py_code = 0;
1958
PyFrameObject *py_frame = 0;
1960
py_srcfile = PyString_FromString(__pyx_filename);
1961
if (!py_srcfile) goto bad;
1962
py_funcname = PyString_FromString(funcname);
1963
if (!py_funcname) goto bad;
1964
py_globals = PyModule_GetDict(__pyx_m);
1965
if (!py_globals) goto bad;
1966
empty_tuple = PyTuple_New(0);
1967
if (!empty_tuple) goto bad;
1968
empty_string = PyString_FromString("");
1969
if (!empty_string) goto bad;
1970
py_code = PyCode_New(
1971
0, /*int argcount,*/
1973
0, /*int stacksize,*/
1975
empty_string, /*PyObject *code,*/
1976
empty_tuple, /*PyObject *consts,*/
1977
empty_tuple, /*PyObject *names,*/
1978
empty_tuple, /*PyObject *varnames,*/
1979
empty_tuple, /*PyObject *freevars,*/
1980
empty_tuple, /*PyObject *cellvars,*/
1981
py_srcfile, /*PyObject *filename,*/
1982
py_funcname, /*PyObject *name,*/
1983
__pyx_lineno, /*int firstlineno,*/
1984
empty_string /*PyObject *lnotab*/
1986
if (!py_code) goto bad;
1987
py_frame = PyFrame_New(
1988
PyThreadState_Get(), /*PyThreadState *tstate,*/
1989
py_code, /*PyCodeObject *code,*/
1990
py_globals, /*PyObject *globals,*/
1991
0 /*PyObject *locals*/
1993
if (!py_frame) goto bad;
1994
py_frame->f_lineno = __pyx_lineno;
1995
PyTraceBack_Here(py_frame);
1997
Py_XDECREF(py_srcfile);
1998
Py_XDECREF(py_funcname);
1999
Py_XDECREF(empty_tuple);
2000
Py_XDECREF(empty_string);
2001
Py_XDECREF(py_code);
2002
Py_XDECREF(py_frame);