mirror of
https://github.com/jorisvink/kore
synced 2025-03-09 04:29:02 -04:00
Two small python improvements.
- Decrement bytes count when python_cmsg_to_list() fails. - Use correct define for PYSOCKET_TYPE_RECVFROM.
This commit is contained in:
parent
5962a94504
commit
01e85fd717
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user