mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 12:39:01 -04:00
pysock: call disable read/write only when needed
This commit is contained in:
parent
d41054bd26
commit
2217c7a2c8
10
src/python.c
10
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user