From a16c594a127e9789215c1404c6cfa161dc090b07 Mon Sep 17 00:00:00 2001 From: Marc Dionne Date: Wed, 28 Sep 2011 21:15:32 -0400 Subject: [PATCH] rx: add post RPC procedure capability Add the ability to specify a procedure that will be called after the end of each RPC for a service. This is similar to the existing afterProc, except that it gets called after the RPC has ended (after EndCall). rx_SetPostProc and rx_GetPostProc are provided to set and retrieve a postProc for a specified service. Reviewed-on: http://gerrit.openafs.org/5529 Tested-by: BuildBot Reviewed-by: Jeffrey Altman (cherry picked from commit 5587bbfc0bc70de234e5655faf7676cf2b9b9715) Change-Id: I1f0a5007b0cf0723ef3ade6a14e72aece2d3cb0f Reviewed-on: http://gerrit.openafs.org/5543 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/rx/rx.c | 4 ++++ src/rx/rx.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/rx/rx.c b/src/rx/rx.c index 33ed31964..7e5e1172e 100644 --- a/src/rx/rx.c +++ b/src/rx/rx.c @@ -1878,6 +1878,10 @@ rxi_ServerProc(int threadID, struct rx_call *newcall, osi_socket * socketp) (*tservice->afterProc) (call, code); rx_EndCall(call, code); + + if (tservice->postProc) + (*tservice->postProc) (code); + if (rx_stats_active) { MUTEX_ENTER(&rx_stats_mutex); rxi_nCalls++; diff --git a/src/rx/rx.h b/src/rx/rx.h index 788e353da..ba692a7bc 100644 --- a/src/rx/rx.h +++ b/src/rx/rx.h @@ -158,6 +158,8 @@ rx_IsLoopbackAddr(afs_uint32 addr) #define rx_SetBeforeProc(service,proc) ((service)->beforeProc = (proc)) #define rx_GetAfterProc(service) ((service)->afterProc) #define rx_GetBeforeProc(service) ((service)->beforeProc) +#define rx_SetPostProc(service,proc) ((service)->postProc = (proc)) +#define rx_GetPostProc(service) ((service)->postProc) /* Define a procedure to be called when a server connection is created */ #define rx_SetNewConnProc(service, proc) ((service)->newConnProc = (proc)) @@ -321,6 +323,7 @@ struct rx_service { void (*newConnProc) (struct rx_connection * tcon); /* Routine to call when a server connection is created */ void (*beforeProc) (struct rx_call * acall); /* routine to call before a call is executed */ void (*afterProc) (struct rx_call * acall, afs_int32 code); /* routine to call after a call is executed */ + void (*postProc) (afs_int32 code); /* routine to call after the call has ended */ u_short maxProcs; /* Maximum procs to be used for this service */ u_short minProcs; /* Minimum # of requests guaranteed executable simultaneously */ u_short connDeadTime; /* Seconds until a client of this service will be declared dead, if it is not responding */ -- 2.39.5