diff options
| author | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
|---|---|---|
| committer | Tomas Chvatal (scarabeus) <tomas.chvatal@gmail.com> | 2008-10-22 22:51:24 +0200 |
| commit | 44daf03024fbf7cbffa10349044786f6ab784821 (patch) | |
| tree | fe311eb22e2d853dfc18fde1a9e55d21815f4f82 /src/base/protect.c~ | |
| parent | e12753d2ec9db83ec08bb9db63902a82fb245cdd (diff) | |
Revert "X"
This reverts commit e12753d2ec9db83ec08bb9db63902a82fb245cdd.
Diffstat (limited to 'src/base/protect.c~')
| -rw-r--r-- | src/base/protect.c~ | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/src/base/protect.c~ b/src/base/protect.c~ deleted file mode 100644 index e83c1ec..0000000 --- a/src/base/protect.c~ +++ /dev/null @@ -1,75 +0,0 @@ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#include "main.h" -#include "myTimer.h" -#include "protect.h" - -protect_t* newProtect() -{ - protect_t *new; - new = malloc( sizeof(protect_t) ); - new->lastMove = getMyTime(); - new->lastPing = getMyTime(); - new->avarage = 0; - new->count = 0; - new->isDown = FALSE; - return new; -} - -void refreshLastMove(protect_t *p) -{ - my_time_t currentTime; - my_time_t interval; - - currentTime = getMyTime(); - interval = currentTime - p->lastMove; - p->lastMove = getMyTime(); - p->avarage += interval; - p->count++; - 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 ) - { - p->isDown = TRUE; - } -#endif - //printf("speed index = %d\n", index); - } -} - -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); -} - -bool_t isDown(protect_t *p) -{ - my_time_t currentTime; - my_time_t interval; - - currentTime = getMyTime(); - interval = currentTime - p->lastPing; - if (interval > PROTECT_PING_INTERVAL_TIMEOUT) - p->isDown = TRUE; - return p->isDown; -} - -void destroyProtect(protect_t *p) -{ - assert( p != NULL ); - free(p); -} |