From 28bec6d456cf70622b2511c98c0ab2a56a2805e5 Mon Sep 17 00:00:00 2001 From: Eric House Date: Tue, 24 Oct 2017 06:20:08 -0700 Subject: [PATCH] implement checkForMoves menu again --- xwords4/linux/relaycon.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index bfb28af9c..3e1b407bb 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -62,6 +62,8 @@ static gboolean relaycon_receive( GIOChannel *source, GIOCondition condition, gpointer data ); static void schedule_next_check( RelayConStorage* storage ); static void reset_schedule_check_interval( RelayConStorage* storage ); +static void checkForMovesOnce( RelayConStorage* storage ); + static ssize_t sendIt( RelayConStorage* storage, const XP_U8* msgbuf, XP_U16 len ); static size_t addVLIStr( XP_U8* buf, size_t len, const XP_UCHAR* str ); static void getNetString( const XP_U8** ptr, XP_U16 len, XP_UCHAR* buf ); @@ -153,7 +155,7 @@ checkForMsgsNow( LaunchParams* params ) { RelayConStorage* storage = getStorage( params ); XP_ASSERT( onMainThread(storage) ); - XP_ASSERT(0); /* FIX ME */ + checkForMovesOnce( storage ); } void @@ -688,7 +690,6 @@ onGotQueryData( gpointer user_data ) /* Currently there's an array of arrays for each relayID (value) */ json_object_object_foreach(reply, relayID, arrOfArrOfMoves) { int len1 = json_object_array_length( arrOfArrOfMoves ); - XP_LOGF( "%s: got key: %s of len %d", __func__, relayID, len1 ); if ( len1 > 0 ) { sqlite3_int64 rowid = *(sqlite3_int64*)g_hash_table_lookup( task->u.query.map, relayID ); for ( int ii = 0; ii < len1; ++ii ) { @@ -771,18 +772,23 @@ handleQuery( RelayTask* task ) g_idle_add( onGotQueryData, task ); } /* handleQuery */ -static gboolean -checkForMoves( gpointer user_data ) +static void +checkForMovesOnce( RelayConStorage* storage ) { LOG_FUNC(); - RelayConStorage* storage = (RelayConStorage*)user_data; XP_ASSERT( onMainThread(storage) ); RelayTask* task = makeRelayTask( storage, QUERY ); sqlite3* dbp = storage->params->pDb; task->u.query.map = getRelayIDsToRowsMap( dbp ); addTask( storage, task ); +} +static gboolean +checkForMoves( gpointer user_data ) +{ + RelayConStorage* storage = (RelayConStorage*)user_data; + checkForMovesOnce( storage ); schedule_next_check( storage ); return FALSE; }