From 64e08dca0bdbb32ec98218a0b0fcd486108af6c1 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 3 Jun 2010 11:51:17 -0400 Subject: [PATCH] Windows: Reduce number of Nat Ping Connections Instruct rx library to only perform NAT pings on file server connections that are actively in use and which are anonymous. LICENSE MIT Change-Id: I6b74e8070f2c522ed13e0c06ea7a304cce525ab9 Reviewed-on: http://gerrit.openafs.org/2077 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman Reviewed-by: Derrick Brashear --- src/WINNT/afsd/cm_conn.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 065d30b698..6534904d48 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -1096,6 +1096,7 @@ void cm_GCConnections(cm_server_t *serverp) cm_PutServer(tcp->serverp); cm_ReleaseUser(userp); *lcpp = tcp->nextp; + rx_SetConnSecondsUntilNatPing(tcp->rxconnp, 0); rx_DestroyConnection(tcp->rxconnp); lock_FinalizeMutex(&tcp->mx); free(tcp); @@ -1162,8 +1163,15 @@ static void cm_NewRXConnection(cm_conn_t *tcp, cm_ucell_t *ucellp, rx_SetConnDeadTime(tcp->rxconnp, ConnDeadtimeout); rx_SetConnHardDeadTime(tcp->rxconnp, HardDeadtimeout); rx_SetConnIdleDeadTime(tcp->rxconnp, IdleDeadtimeout); - if (NatPingInterval) + + /* + * Attempt to limit NAT pings to the anonymous file server connections. + * Only file servers implement client callbacks and we only need one ping + * to be sent to each server. + */ + if (NatPingInterval && serverp->type == CM_SERVER_FILE && secIndex == 0) rx_SetConnSecondsUntilNatPing(tcp->rxconnp, NatPingInterval); + tcp->ucgen = ucellp->gen; if (secObjp) rxs_Release(secObjp); /* Decrement the initial refCount */ @@ -1228,6 +1236,7 @@ long cm_ConnByServer(cm_server_t *serverp, cm_user_t *userp, cm_conn_t **connpp) else osi_Log0(afsd_logp, "cm_ConnByServer replace connection due to crypt change"); tcp->flags &= ~CM_CONN_FLAG_FORCE_NEW; + rx_SetConnSecondsUntilNatPing(tcp->rxconnp, 0); rx_DestroyConnection(tcp->rxconnp); cm_NewRXConnection(tcp, ucellp, serverp); }