Skip to content

Commit fd16d72

Browse files
committed
Removed stream socket from sync builds.
1 parent a7b0767 commit fd16d72

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/ngx_stream_python_session.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ typedef struct {
2626
PyObject_HEAD
2727
ngx_stream_session_t *session;
2828
PyObject *ctx;
29+
#if !(NGX_PYTHON_SYNC)
2930
PyObject *sock;
31+
#endif
3032
} ngx_stream_python_session_t;
3133

3234

@@ -244,20 +246,30 @@ ngx_stream_python_session_get_sock(ngx_stream_python_session_t *self)
244246
return NULL;
245247
}
246248

249+
#if !(NGX_PYTHON_SYNC)
250+
247251
ngx_log_debug0(NGX_LOG_DEBUG_STREAM, s->connection->log, 0,
248252
"stream python get sock");
249253

250254
Py_INCREF(self->sock);
251255

252256
return self->sock;
257+
258+
#else
259+
PyErr_SetString(ngx_stream_python_session_error,
260+
"stream socket is not available in sync builds");
261+
return NULL;
262+
#endif
253263
}
254264

255265

256266
static void
257267
ngx_stream_python_session_dealloc(ngx_stream_python_session_t *self)
258268
{
259269
Py_XDECREF(self->ctx);
270+
#if !(NGX_PYTHON_SYNC)
260271
Py_XDECREF(self->sock);
272+
#endif
261273

262274
self->ob_type->tp_free((PyObject*) self);
263275
}

0 commit comments

Comments
 (0)