diff options
author | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2008-02-04 17:51:38 +1100 |
commit | 77f71c1b65358723771354fd9ff1dc418b227ccc (patch) | |
tree | 2b1b96d1f3dcd55997fd6d48e75085ff506fb0a2 /source4/lib/messaging | |
parent | 23d681caf9c1186999ac676d70a1eb0e8a43e358 (diff) | |
download | samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.gz samba-77f71c1b65358723771354fd9ff1dc418b227ccc.tar.bz2 samba-77f71c1b65358723771354fd9ff1dc418b227ccc.zip |
Rework cluster_id() to take an additional argument, as we need
<node>.<pid>.<fd> to be unique in a prefork process environment.
Andrew Bartlett and David Disseldorp
(This used to be commit 931994a7f185bbc98924823e9e8cef1011dd0957)
Diffstat (limited to 'source4/lib/messaging')
-rw-r--r-- | source4/lib/messaging/messaging.c | 8 | ||||
-rw-r--r-- | source4/lib/messaging/tests/irpc.c | 10 | ||||
-rw-r--r-- | source4/lib/messaging/tests/messaging.c | 10 |
3 files changed, 15 insertions, 13 deletions
diff --git a/source4/lib/messaging/messaging.c b/source4/lib/messaging/messaging.c index 811d5a85bf..9cb10f961c 100644 --- a/source4/lib/messaging/messaging.c +++ b/source4/lib/messaging/messaging.c @@ -263,8 +263,10 @@ static void messaging_send_handler(struct messaging_context *msg) } rec->retries = 0; if (!NT_STATUS_IS_OK(status)) { - DEBUG(1,("messaging: Lost message from %u to %u of type %u - %s\n", - rec->header->from.id, rec->header->to.id, rec->header->msg_type, + DEBUG(1,("messaging: Lost message from %s to %s of type %u - %s\n", + cluster_id_string(debug_ctx(), rec->header->from), + cluster_id_string(debug_ctx(), rec->header->to), + rec->header->msg_type, nt_errstr(status))); } DLIST_REMOVE(msg->pending, rec); @@ -1051,7 +1053,7 @@ struct server_id *irpc_servers_byname(struct messaging_context *msg_ctx, for (i=0;i<count;i++) { ret[i] = ((struct server_id *)rec.dptr)[i]; } - ret[i] = cluster_id(0); + ret[i] = cluster_id(0, 0); free(rec.dptr); tdb_unlock_bystring(t->tdb, name); talloc_free(t); diff --git a/source4/lib/messaging/tests/irpc.c b/source4/lib/messaging/tests/irpc.c index a2995fc983..d9b0548643 100644 --- a/source4/lib/messaging/tests/irpc.c +++ b/source4/lib/messaging/tests/irpc.c @@ -93,7 +93,7 @@ static bool test_addone(struct torture_context *test, const void *_data, r.in.in_data = value; test_debug = true; - status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), + status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2), rpcecho, ECHO_ADDONE, &r, test); test_debug = false; torture_assert_ntstatus_ok(test, status, "AddOne failed"); @@ -122,7 +122,7 @@ static bool test_echodata(struct torture_context *tctx, r.in.in_data = (unsigned char *)talloc_strdup(mem_ctx, "0123456789"); r.in.len = strlen((char *)r.in.in_data); - status = IRPC_CALL(data->msg_ctx1, cluster_id(MSG_ID2), + status = IRPC_CALL(data->msg_ctx1, cluster_id(0, MSG_ID2), rpcecho, ECHO_ECHODATA, &r, mem_ctx); torture_assert_ntstatus_ok(tctx, status, "EchoData failed"); @@ -180,7 +180,7 @@ static bool test_speed(struct torture_context *tctx, while (timeval_elapsed(&tv) < timelimit) { struct irpc_request *irpc; - irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(MSG_ID2), + irpc = IRPC_CALL_SEND(data->msg_ctx1, cluster_id(0, MSG_ID2), rpcecho, ECHO_ADDONE, &r, mem_ctx); torture_assert(tctx, irpc != NULL, "AddOne send failed"); @@ -221,7 +221,7 @@ static bool irpc_setup(struct torture_context *tctx, void **_data) torture_assert(tctx, data->msg_ctx1 = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(MSG_ID1), + cluster_id(0, MSG_ID1), lp_iconv_convenience(tctx->lp_ctx), data->ev), "Failed to init first messaging context"); @@ -229,7 +229,7 @@ static bool irpc_setup(struct torture_context *tctx, void **_data) torture_assert(tctx, data->msg_ctx2 = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(MSG_ID2), + cluster_id(0, MSG_ID2), lp_iconv_convenience(tctx->lp_ctx), data->ev), "Failed to init second messaging context"); diff --git a/source4/lib/messaging/tests/messaging.c b/source4/lib/messaging/tests/messaging.c index 0df04bce2b..45b573518c 100644 --- a/source4/lib/messaging/tests/messaging.c +++ b/source4/lib/messaging/tests/messaging.c @@ -73,7 +73,7 @@ static bool test_ping_speed(struct torture_context *tctx) msg_server_ctx = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(1), + cluster_id(0, 1), lp_iconv_convenience(tctx->lp_ctx), ev); @@ -84,7 +84,7 @@ static bool test_ping_speed(struct torture_context *tctx) msg_client_ctx = messaging_init(tctx, lp_messaging_path(tctx, tctx->lp_ctx), - cluster_id(2), + cluster_id(0, 2), lp_iconv_convenience(tctx->lp_ctx), ev); @@ -103,8 +103,8 @@ static bool test_ping_speed(struct torture_context *tctx) data.data = discard_const_p(uint8_t, "testing"); data.length = strlen((const char *)data.data); - status1 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, &data); - status2 = messaging_send(msg_client_ctx, cluster_id(1), msg_ping, NULL); + status1 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, &data); + status2 = messaging_send(msg_client_ctx, cluster_id(0, 1), msg_ping, NULL); torture_assert_ntstatus_ok(tctx, status1, "msg1 failed"); ping_count++; @@ -124,7 +124,7 @@ static bool test_ping_speed(struct torture_context *tctx) } torture_comment(tctx, "sending exit\n"); - messaging_send(msg_client_ctx, cluster_id(1), msg_exit, NULL); + messaging_send(msg_client_ctx, cluster_id(0, 1), msg_exit, NULL); torture_assert_int_equal(tctx, ping_count, pong_count, "ping test failed"); |