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 01e85fd717e492b39958445495a18a9adfbb6ac6
parent 5962a945046c37d9594be8c7aefd6dba20e32c33
Author: Joris Vink <joris@coders.se>
Date:   Wed,  3 Nov 2021 15:19:43 +0100

Two small python improvements.

- Decrement bytes count when python_cmsg_to_list() fails.
- Use correct define for PYSOCKET_TYPE_RECVFROM.

Diffstat:
src/python.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/python.c b/src/python.c @@ -3545,8 +3545,10 @@ pysocket_async_recv(struct pysocket_op *op) return (NULL); case PYSOCKET_TYPE_RECVMSG: socklen = msg.msg_namelen; - if ((list = python_cmsg_to_list(&msg)) == NULL) + if ((list = python_cmsg_to_list(&msg)) == NULL) { + Py_DECREF(bytes); return (NULL); + } break; case PYSOCKET_TYPE_RECVFROM: break; @@ -3559,7 +3561,7 @@ pysocket_async_recv(struct pysocket_op *op) port = ntohs(op->sendaddr.ipv4.sin_port); ip = inet_ntoa(op->sendaddr.ipv4.sin_addr); - if (op->type == PYSOCKET_TYPE_RECV) + if (op->type == PYSOCKET_TYPE_RECVFROM) tuple = Py_BuildValue("(sHN)", ip, port, bytes); else tuple = Py_BuildValue("(sHNN)", ip, port, bytes, list);