summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGary Lockyer <gary@catalyst.net.nz>2017-03-16 16:26:01 +1300
committerAndrew Bartlett <abartlet@samba.org>2017-03-28 09:23:11 +0200
commit16e9448174a7cb7ece90a7a68b7f0fd8ffa4de91 (patch)
tree93d77b51cba348b0f146a9ecadfa1b1784701924 /source4
parent8c75d9fc73614fad29a998d08c4b11034ab2aebb (diff)
downloadsamba-16e9448174a7cb7ece90a7a68b7f0fd8ffa4de91.tar.gz
pymessaging: add single element tupple form of the server_id
This avoids the python code needing to call getpid() internally, while declaring a stable task_id. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/messaging/pymessaging.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/source4/lib/messaging/pymessaging.c b/source4/lib/messaging/pymessaging.c
index 2d1601d5fd3..d83f5e6a637 100644
--- a/source4/lib/messaging/pymessaging.c
+++ b/source4/lib/messaging/pymessaging.c
@@ -62,13 +62,20 @@ static bool server_id_from_py(PyObject *object, struct server_id *server_id)
server_id->task_id = task_id;
server_id->vnn = vnn;
return true;
- } else {
+ } else if (PyTuple_Size(object) == 2) {
unsigned long long pid;
int task_id;
if (!PyArg_ParseTuple(object, "KI", &pid, &task_id))
return false;
*server_id = cluster_id(pid, task_id);
return true;
+ } else {
+ unsigned long long pid = getpid();
+ int task_id;
+ if (!PyArg_ParseTuple(object, "I", &task_id))
+ return false;
+ *server_id = cluster_id(pid, task_id);
+ return true;
}
}