switch to milliseconds

This commit is contained in:
Eric House 2017-10-25 06:15:46 -07:00
parent cc54621e45
commit d05a67ed4b

View file

@ -29,13 +29,13 @@
#include "comtypes.h" #include "comtypes.h"
#include "gamesdb.h" #include "gamesdb.h"
#define MAX_MOVE_CHECK_SECS ((XP_U16)(60 * 60 * 24)) #define MAX_MOVE_CHECK_MS ((XP_U16)(1000 * 60 * 60 * 24))
#define RELAY_API_PROTO "http" #define RELAY_API_PROTO "http"
typedef struct _RelayConStorage { typedef struct _RelayConStorage {
pthread_t mainThread; pthread_t mainThread;
guint moveCheckerID; guint moveCheckerID;
XP_U16 nextMoveCheckSecs; XP_U32 nextMoveCheckMS;
pthread_cond_t relayCondVar; pthread_cond_t relayCondVar;
pthread_mutex_t relayMutex; pthread_mutex_t relayMutex;
GSList* relayTaskList; GSList* relayTaskList;
@ -779,7 +779,7 @@ static void
reset_schedule_check_interval( RelayConStorage* storage ) reset_schedule_check_interval( RelayConStorage* storage )
{ {
XP_ASSERT( onMainThread(storage) ); XP_ASSERT( onMainThread(storage) );
storage->nextMoveCheckSecs = 0; storage->nextMoveCheckMS = 0;
} }
static void static void
@ -792,14 +792,14 @@ schedule_next_check( RelayConStorage* storage )
storage->moveCheckerID = 0; storage->moveCheckerID = 0;
} }
storage->nextMoveCheckSecs *= 2; storage->nextMoveCheckMS *= 2;
if ( storage->nextMoveCheckSecs > MAX_MOVE_CHECK_SECS ) { if ( storage->nextMoveCheckMS > MAX_MOVE_CHECK_MS ) {
storage->nextMoveCheckSecs = MAX_MOVE_CHECK_SECS; storage->nextMoveCheckMS = MAX_MOVE_CHECK_MS;
} else if ( storage->nextMoveCheckSecs == 0 ) { } else if ( storage->nextMoveCheckMS == 0 ) {
storage->nextMoveCheckSecs = 1; storage->nextMoveCheckMS = 250;
} }
storage->moveCheckerID = g_timeout_add( 1000 * storage->nextMoveCheckSecs, storage->moveCheckerID = g_timeout_add( storage->nextMoveCheckMS,
checkForMoves, storage ); checkForMoves, storage );
XP_ASSERT( storage->moveCheckerID != 0 ); XP_ASSERT( storage->moveCheckerID != 0 );
} }