pgprpcpwdcache.c

来自「可以实现对邮件的加密解密以及签名」· C语言 代码 · 共 44 行

C
44
字号
/*____________________________________________________________________________
	Copyright (C) 2002 PGP Corporation
	All rights reserved.

	$Id: pgpRPCPwdCache.c,v 1.9 2002/08/06 20:11:21 dallen Exp $
____________________________________________________________________________*/
#include <windows.h>
#include "pgpPubTypes.h"
#include "pgpRPCMsg.h"
#include "pgpPassCach.h"
#include "pgpKeyPriv.h"
#include "pgpThreads.h"

#define CACHETIME	10000
#define TOKENTIME	 5000

extern PGPMutex_t sRpcMutex;
extern PGPContextRef gCtx;

void
pgpRPCThread(void *dummy)
{
	int count = 0;

	for(;;) {
		SleepEx( TOKENTIME, FALSE );

		PGPMutexLock( &sRpcMutex );
		pgpPollTokens( gCtx );
		PGPMutexUnlock( &sRpcMutex );

		if( ++count >= (CACHETIME/TOKENTIME) )
		{
			pgpExpirePassphraseCache( gCtx );

			PGPMutexLock( &sRpcMutex );
			pgpExpireKeyDBCache( gCtx );
			PGPMutexUnlock( &sRpcMutex );

			count = 0;
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?