mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-04 23:02:02 +01:00
cleanup: method names and logging
This commit is contained in:
parent
66d6240ece
commit
55f5b500e3
5 changed files with 36 additions and 10 deletions
|
@ -1773,7 +1773,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( consumed ) {
|
if ( consumed ) {
|
||||||
XP_LOGF( "%s: rejecting data message", __func__ );
|
XP_LOGF( "%s: rejecting data message (consumed)", __func__ );
|
||||||
} else {
|
} else {
|
||||||
*senderID = srcID;
|
*senderID = srcID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -513,7 +513,7 @@ static void
|
||||||
handle_movescheck( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* apg )
|
handle_movescheck( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* apg )
|
||||||
{
|
{
|
||||||
LaunchParams* params = apg->params;
|
LaunchParams* params = apg->params;
|
||||||
checkForMsgsNow( params );
|
relaycon_checkMsgs( params );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -215,8 +215,9 @@ runWitCurl( RelayTask* task, const gchar* proc, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
checkForMsgsNow( LaunchParams* params )
|
relaycon_checkMsgs( LaunchParams* params )
|
||||||
{
|
{
|
||||||
|
LOG_FUNC();
|
||||||
RelayConStorage* storage = getStorage( params );
|
RelayConStorage* storage = getStorage( params );
|
||||||
XP_ASSERT( onMainThread(storage) );
|
XP_ASSERT( onMainThread(storage) );
|
||||||
checkForMovesOnce( storage );
|
checkForMovesOnce( storage );
|
||||||
|
@ -414,6 +415,30 @@ onMainThread( RelayConStorage* storage )
|
||||||
return storage->mainThread = pthread_self();
|
return storage->mainThread = pthread_self();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const gchar*
|
||||||
|
taskName( const RelayTask* task )
|
||||||
|
{
|
||||||
|
switch (task->typ) {
|
||||||
|
case POST: return "POST";
|
||||||
|
case QUERY: return "QUERY";
|
||||||
|
default: XP_ASSERT(0);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gchar*
|
||||||
|
listTasks( GSList* tasks )
|
||||||
|
{
|
||||||
|
gchar* names[1 + g_slist_length(tasks)];
|
||||||
|
names[g_slist_length(tasks)] = NULL;
|
||||||
|
for ( int ii = 0; !!tasks; ++ii ) {
|
||||||
|
names[ii] = (gchar*)taskName( (RelayTask*)tasks->data );
|
||||||
|
tasks = tasks->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
return g_strjoinv( ",", names );
|
||||||
|
}
|
||||||
|
|
||||||
static void*
|
static void*
|
||||||
relayThread( void* arg )
|
relayThread( void* arg )
|
||||||
{
|
{
|
||||||
|
@ -431,10 +456,13 @@ relayThread( void* arg )
|
||||||
RelayTask* task = head->data;
|
RelayTask* task = head->data;
|
||||||
g_slist_free( head );
|
g_slist_free( head );
|
||||||
|
|
||||||
|
gchar* strs = listTasks(storage->relayTaskList);
|
||||||
|
|
||||||
pthread_mutex_unlock( &storage->relayMutex );
|
pthread_mutex_unlock( &storage->relayMutex );
|
||||||
|
|
||||||
XP_LOGF( "%s(): processing one of %d; created %d secs ago",
|
XP_LOGF( "%s(): processing one of %d (%s); created %d secs ago",
|
||||||
__func__, len, ((XP_U32)time(NULL)) - task->ctime );
|
__func__, len, strs, ((XP_U32)time(NULL)) - task->ctime );
|
||||||
|
g_free( strs );
|
||||||
|
|
||||||
switch ( task->typ ) {
|
switch ( task->typ ) {
|
||||||
case POST:
|
case POST:
|
||||||
|
|
|
@ -59,5 +59,5 @@ void relaycon_cleanup( LaunchParams* params );
|
||||||
XP_U32 makeClientToken( sqlite3_int64 rowid, XP_U16 seed );
|
XP_U32 makeClientToken( sqlite3_int64 rowid, XP_U16 seed );
|
||||||
void rowidFromToken( XP_U32 clientToken, sqlite3_int64* rowid, XP_U16* seed );
|
void rowidFromToken( XP_U32 clientToken, sqlite3_int64* rowid, XP_U16* seed );
|
||||||
|
|
||||||
void checkForMsgsNow( LaunchParams* params );
|
void relaycon_checkMsgs( LaunchParams* params );
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -478,10 +478,8 @@ update_ldevid() {
|
||||||
if [ $RNUM -lt 30 ]; then # upgrade or first run
|
if [ $RNUM -lt 30 ]; then # upgrade or first run
|
||||||
CMD="--ldevid LINUX_TEST_$(printf %.5d ${KEY})_"
|
CMD="--ldevid LINUX_TEST_$(printf %.5d ${KEY})_"
|
||||||
fi
|
fi
|
||||||
else
|
elif [ $RNUM -lt 10 ]; then
|
||||||
if [ $RNUM -lt 10 ]; then
|
CMD="${CMD}x" # give it a new local ID
|
||||||
CMD="${CMD}x" # give it a new local ID
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
ARGS_DEVID[$KEY]="$CMD"
|
ARGS_DEVID[$KEY]="$CMD"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue