From 69d772bb81c455811b03385c83682df95176ed21 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Milo=C5=A1=20Mula=C4=8D?= Date: Wed, 4 Feb 2009 08:19:17 +0000 Subject: [PATCH] enable receiving notifications for more notifIDs --- org.glite.lb.client/src/notify.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/org.glite.lb.client/src/notify.c b/org.glite.lb.client/src/notify.c index 6e607b3..9b77748 100644 --- a/org.glite.lb.client/src/notify.c +++ b/org.glite.lb.client/src/notify.c @@ -41,9 +41,9 @@ static void usage(char *cmd) " -c Match only on state change\n\n" , me); if ( !cmd || !strcmp(cmd, "bind") ) - fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } -t requested_validity ] notifid\n" + fprintf(stderr,"\n'bind' command usage: %s bind [ { -s socket_fd | -a fake_addr } -t requested_validity ] notifids \n" " requested_validity Validity of notification req. in seconds\n" - " notifid Notification ID\n" + " notifids One or more notification ID's\n" " fake_addr Fake the client address\n", me); /* UNIMPL if ( !cmd || !strcmp(cmd, "change") ) @@ -239,7 +239,9 @@ int main(int argc,char **argv) memset(&stat,0,sizeof stat); if (sock == -1) { - if ( (optind+1 == argc) || edg_wll_NotifIdParse(argv[optind+1], &nid) ) + int param = optind+1; + + if (param == argc) { fprintf(stderr, "Notification ID parameter not set propperly!\n\n"); usage("receive"); @@ -248,10 +250,20 @@ int main(int argc,char **argv) valid = time(NULL) + opt_valid; - if (edg_wll_NotifBind(ctx, nid, -1, fake_addr, &valid) ) - goto receive_err; - fprintf(stderr,"notification is valid until: %s (%ld)\n", TimeToStr(valid), valid); + while (param < argc) { + if (edg_wll_NotifIdParse(argv[param], &nid)) { + fprintf(stderr, "Notification ID parameter not set propperly!\n\n"); + usage("receive"); + return EX_USAGE; + } + if (edg_wll_NotifBind(ctx, nid, -1, fake_addr, &valid) ) + goto receive_err; + fprintf(stderr,"notification is valid until: %s (%ld)\n", TimeToStr(valid), valid); + + if (nid) edg_wll_NotifIdFree(nid); nid = NULL; + param++; + } now = time(NULL); do_refresh = now + (refresh ? (valid - now)/2 : 999999999); if (refresh) fprintf(stderr,"next refresh %s (%ld)\n", -- 1.8.2.3