From 7e6fb590004ef8aa149ab4e02cf111c7a60fcc01 Mon Sep 17 00:00:00 2001 From: hadaq Date: Mon, 16 Aug 2004 11:25:53 +0000 Subject: [PATCH] do a proper deregistration of online service --- hadaq/evtbuild.c | 3 ++- hadaq/online.c | 20 +++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/hadaq/evtbuild.c b/hadaq/evtbuild.c index a482151..3ed0b56 100644 --- a/hadaq/evtbuild.c +++ b/hadaq/evtbuild.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.69 2004-08-13 10:30:00 hadaq Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/evtbuild.c,v 6.70 2004-08-16 11:25:53 hadaq Exp $"; #define _POSIX_C_SOURCE 199309L @@ -688,6 +688,7 @@ int main(int argc, char *argv[]) for (i = 0; i < theArgs->nrOfMsgs; i++) { ShmTrans_remove(shmTrans[i]); } + finiOnline(); Worker_fini(worker); exit(EXIT_SUCCESS); diff --git a/hadaq/online.c b/hadaq/online.c index 79ab41e..19e825b 100644 --- a/hadaq/online.c +++ b/hadaq/online.c @@ -1,4 +1,4 @@ -static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/online.c,v 6.9 2003-05-14 13:54:45 muench Exp $"; +static char *rcsId = "$Header: /misc/hadesprojects/daq/cvsroot/eventbuilder/hadaq/online.c,v 6.10 2004-08-16 11:25:53 hadaq Exp $"; #define _GNU_SOURCE @@ -15,27 +15,33 @@ static void *ourEvt; extern void daqprog_1(); -static struct timeval timeout = -{0, 0}; +static struct timeval timeout = { 0, 0 }; + +static SVCXPRT *ourTransp; initOnline() { - register SVCXPRT *transp; (void) pmap_unset(DAQPROG, DAQVERS); - transp = svctcp_create(RPC_ANYSOCK, 0, 0); - if (transp == NULL) { + ourTransp = svctcp_create(RPC_ANYSOCK, 0, 0); + if (ourTransp == NULL) { fprintf(stderr, "cannot create tcp service."); return -1; } - if (!svc_register(transp, DAQPROG, DAQVERS, daqprog_1, IPPROTO_TCP)) { + if (!svc_register(ourTransp, DAQPROG, DAQVERS, daqprog_1, IPPROTO_TCP)) { fprintf(stderr, "unable to register (DAQPROG, DAQVERS, tcp)."); return -1; } return 0; } +int finiOnline(void) +{ + svc_unregister(DAQPROG, DAQVERS); + svc_destroy(ourTransp); +} + void Evt_online(void *evt) { fd_set readfdset; -- 2.43.0