Bugzilla Bug 284839: checked in Bob Relyea's patch to improve the

responsiveness of SECMOD_WaitForAnyTokenEvent. r=wtc,nelsonb.
Modified Files: lib/dev/dev.h lib/dev/devslot.c lib/pk11wrap/pk11util.c
This commit is contained in:
wtchang%redhat.com 2005-03-07 21:20:38 +00:00
parent 05c3422175
commit 11ee6948b1
3 changed files with 22 additions and 2 deletions

View File

@ -44,7 +44,7 @@
*/
#ifdef DEBUG
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.36 $ $Date: 2005/01/20 02:25:47 $";
static const char DEV_CVS_ID[] = "@(#) $RCSfile: dev.h,v $ $Revision: 1.37 $ $Date: 2005/03/07 21:20:38 $";
#endif /* DEBUG */
#ifndef NSSCKT_H
@ -250,6 +250,12 @@ nssSlot_AddRef
NSSSlot *slot
);
NSS_EXTERN void
nssSlot_ResetDelay
(
NSSSlot *slot
);
NSS_EXTERN NSSUTF8 *
nssSlot_GetName
(

View File

@ -35,7 +35,7 @@
* ***** END LICENSE BLOCK ***** */
#ifdef DEBUG
static const char CVS_ID[] = "@(#) $RCSfile: devslot.c,v $ $Revision: 1.20 $ $Date: 2005/01/20 02:25:47 $";
static const char CVS_ID[] = "@(#) $RCSfile: devslot.c,v $ $Revision: 1.21 $ $Date: 2005/03/07 21:20:38 $";
#endif /* DEBUG */
#ifndef NSSCKEPV_H
@ -242,6 +242,14 @@ nssSlot_GetTokenName (
return nssToken_GetName(slot->token);
}
NSS_IMPLEMENT void
nssSlot_ResetDelay (
NSSSlot *slot
)
{
slot->lastTokenPing = 0;
}
static PRBool
within_token_delay_period(NSSSlot *slot)
{

View File

@ -44,6 +44,7 @@
#include "pk11func.h"
#include "pki3hack.h"
#include "secerr.h"
#include "dev.h"
/* these are for displaying error messages */
@ -1097,6 +1098,11 @@ SECMOD_WaitForAnyTokenEvent(SECMODModule *mod, unsigned long flags,
SECMOD_UpdateSlotList(mod);
slot = SECMOD_FindSlotByID(mod, id);
}
/* if we are in the delay period for the "isPresent" call, reset
* the delay since we know things have probably changed... */
if (slot && slot->nssToken && slot->nssToken->slot) {
nssSlot_ResetDelay(slot->nssToken->slot);
}
return slot;
/* must be called with the lock on. */