From 9dfe06de4a4beffc708b9f273807520935b677dc Mon Sep 17 00:00:00 2001 From: Peter Silva Date: Thu, 5 Dec 2024 15:03:40 -0500 Subject: [PATCH] change exchangeSplit to base hash on path --- sr_post.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/sr_post.c b/sr_post.c index 99eb936..1e1c8c4 100644 --- a/sr_post.c +++ b/sr_post.c @@ -517,9 +517,19 @@ void sr_post_message(struct sr_context *sr_c, struct sr_message_s *m) strcpy(thisexchange, sr_c->cfg->post_broker->exchange); if (sr_c->cfg->post_broker->exchangeSplit > 0) { + int tot=0; + char *basis=NULL; + if ( m->relPath ) { basis=m->relPath; } + // else if (m->retrievePath) { basis=m->retrievePath; } + + tot=0; + if (basis) { + for (int i=0; i < strlen(basis); i++ ) { + tot += basis[i]; + } + } sprintf(strchr(thisexchange, '\0'), "%02d", - m->sum[sr_get_sumhashlen(m->sum[0]) - - 1] % sr_c->cfg->post_broker->exchangeSplit); + tot % sr_c->cfg->post_broker->exchangeSplit); } status = amqp_basic_publish(sr_c->cfg->post_broker->conn, 1,