1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-24 02:04:21 +03:00

pymessaging: Pass around the server_id struct to python callbacks rather than the tuple

This is not used currently, but may avoid going to and from the python types when we do not need to.

Andrew Bartlett

Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Andrew Bartlett 2013-01-26 09:09:23 +11:00 committed by Stefan Metzmacher
parent a3054323d3
commit a321dd3aaf

View File

@ -163,10 +163,20 @@ static void py_msg_callback_wrapper(struct imessaging_context *msg, void *privat
uint32_t msg_type,
struct server_id server_id, DATA_BLOB *data)
{
PyObject *callback = (PyObject *)private_data;
PyObject *py_server_id, *callback = (PyObject *)private_data;
PyObject_CallFunction(callback, discard_const_p(char, "i(KII)s#"), msg_type,
server_id.pid, server_id.task_id, server_id.vnn,
struct server_id *p_server_id = talloc(NULL, struct server_id);
if (!p_server_id) {
PyErr_NoMemory();
return;
}
*p_server_id = server_id;
py_server_id = py_return_ndr_struct("samba.dcerpc.server_id", "server_id", p_server_id, p_server_id);
talloc_unlink(NULL, p_server_id);
PyObject_CallFunction(callback, discard_const_p(char, "i(O)s#"), msg_type,
py_server_id,
data->data, data->length);
}