kore

Kore is a web application platform for writing scalable, concurrent web based processes in C or Python.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

commit 2217c7a2c83cea3d76d95b2b8e6ed4bb1640f3be
parent d41054bd265b4a3487c094bf9c9b991c0ce8253b
Author: Joris Vink <joris@coders.se>
Date:   Thu, 14 Mar 2019 09:27:13 +0100

pysock: call disable read/write only when needed

Diffstat:
src/python.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/python.c b/src/python.c @@ -1657,7 +1657,7 @@ pysocket_alloc(void) static void pysocket_dealloc(struct pysocket *sock) { - if (sock->scheduled) { + if (sock->scheduled && sock->fd == -1) { kore_platform_disable_read(sock->fd); #if !defined(__linux__) kore_platform_disable_write(sock->fd); @@ -1838,6 +1838,14 @@ pysocket_connect(struct pysocket *sock, PyObject *args) static PyObject * pysocket_close(struct pysocket *sock, PyObject *args) { + if (sock->scheduled) { + sock->scheduled = 0; + kore_platform_disable_read(sock->fd); +#if !defined(__linux__) + kore_platform_disable_write(sock->fd); +#endif + } + if (sock->socket != NULL) { Py_DECREF(sock->socket); sock->socket = NULL;