diff options
| author | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-15 19:57:10 +0000 |
|---|---|---|
| committer | scarab <scarab@0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e> | 2008-08-15 19:57:10 +0000 |
| commit | 7bbd60007620cf3cc3ee7a913f7010588808ebb2 (patch) | |
| tree | 34e72f66dfd1076e23c43074786f935aca70cba1 /src/base/protect.c | |
| parent | 50ba3d5e1e9f9eeda049a348efa4645af07610bc (diff) | |
"- initial commit for GETTEXT support and K&R compilance"
git-svn-id: http://opensvn.csie.org/tuxanci_ng@196 0ee4d065-81f0-4d1e-b06c-ff20ad07cc3e
Diffstat (limited to 'src/base/protect.c')
| -rw-r--r-- | src/base/protect.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/base/protect.c b/src/base/protect.c index cf567b8..e83c1ec 100644 --- a/src/base/protect.c +++ b/src/base/protect.c @@ -11,7 +11,6 @@ protect_t* newProtect() { protect_t *new; - new = malloc( sizeof(protect_t) ); new->lastMove = getMyTime(); new->lastPing = getMyTime(); @@ -27,21 +26,16 @@ void refreshLastMove(protect_t *p) my_time_t interval; currentTime = getMyTime(); - interval = currentTime - p->lastMove; p->lastMove = getMyTime(); - p->avarage += interval; p->count++; - - if( p->count == PROTECT_SPEED_AVARAGE ) - { + if (p->count == PROTECT_SPEED_AVARAGE) { int index; index = p->avarage/PROTECT_SPEED_AVARAGE; p->avarage = 0; p->count = 0; - #if 0 if( index < PROTECT_SPEED_INTERVAL_TIMEOUT ) { @@ -56,12 +50,9 @@ void rereshLastPing(protect_t *p) { //my_time_t currentTime; //my_time_t interval; - //currentTime = getMyTime(); - //interval = currentTime - p->lastPing; p->lastPing = getMyTime(); - //printf("interval = %d\n", interval); } @@ -71,14 +62,9 @@ bool_t isDown(protect_t *p) my_time_t interval; currentTime = getMyTime(); - interval = currentTime - p->lastPing; - - if( interval > PROTECT_PING_INTERVAL_TIMEOUT ) - { + if (interval > PROTECT_PING_INTERVAL_TIMEOUT) p->isDown = TRUE; - } - return p->isDown; } |