From 94f3b715e58b3773e3ba660aa2a6c239760fee5e Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Sat, 1 Jan 2011 12:03:12 +0100 Subject: [PATCH] fixed cluster node names --- plugins/python/uwsgi_pymodule.c | 3 ++- uwsgi.c | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/python/uwsgi_pymodule.c b/plugins/python/uwsgi_pymodule.c index 572434fa..b11b8c2b 100644 --- a/plugins/python/uwsgi_pymodule.c +++ b/plugins/python/uwsgi_pymodule.c @@ -1861,7 +1861,7 @@ PyObject *py_uwsgi_cluster_node_name(PyObject * self, PyObject * args) { int i; char *node = NULL; - if (!PyArg_ParseTuple(args, "s:cluster_node_name", &node)) { + if (!PyArg_ParseTuple(args, "|s:cluster_node_name", &node)) { return NULL; } @@ -1872,6 +1872,7 @@ PyObject *py_uwsgi_cluster_node_name(PyObject * self, PyObject * args) { for (i = 0; i < MAX_CLUSTER_NODES; i++) { ucn = &uwsgi.shared->nodes[i]; if (ucn->name[0] != 0) { + uwsgi_log("node_name: %s %s\n", node, ucn->name); if (!strcmp(ucn->name, node)) { return PyString_FromString(ucn->nodename); } diff --git a/uwsgi.c b/uwsgi.c index 156b1e44..a3095335 100644 --- a/uwsgi.c +++ b/uwsgi.c @@ -2140,6 +2140,7 @@ void uwsgi_cluster_add_node(struct uwsgi_cluster_node *nucn, int type) { if (ucn->name[0] == 0) { memcpy(ucn->name, nucn->name, strlen(nucn->name) + 1); + memcpy(ucn->nodename, nucn->nodename, strlen(nucn->nodename) + 1); ucn->workers = nucn->workers; ucn->ucn_addr.sin_family = AF_INET; ucn->ucn_addr.sin_port = htons(atoi(tcp_port + 1));