cleanup: method names and logging

This commit is contained in:
Eric House 2017-11-02 06:19:35 -07:00
parent 66d6240ece
commit 55f5b500e3
5 changed files with 36 additions and 10 deletions

View file

@ -1773,7 +1773,7 @@ relayPreProcess( CommsCtxt* comms, XWStreamCtxt* stream, XWHostID* senderID )
}
if ( consumed ) {
XP_LOGF( "%s: rejecting data message", __func__ );
XP_LOGF( "%s: rejecting data message (consumed)", __func__ );
} else {
*senderID = srcID;
}

View file

@ -513,7 +513,7 @@ static void
handle_movescheck( GtkWidget* XP_UNUSED(widget), GtkAppGlobals* apg )
{
LaunchParams* params = apg->params;
checkForMsgsNow( params );
relaycon_checkMsgs( params );
}
static void

View file

@ -215,8 +215,9 @@ runWitCurl( RelayTask* task, const gchar* proc, ...)
}
void
checkForMsgsNow( LaunchParams* params )
relaycon_checkMsgs( LaunchParams* params )
{
LOG_FUNC();
RelayConStorage* storage = getStorage( params );
XP_ASSERT( onMainThread(storage) );
checkForMovesOnce( storage );
@ -414,6 +415,30 @@ onMainThread( RelayConStorage* storage )
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*
relayThread( void* arg )
{
@ -431,10 +456,13 @@ relayThread( void* arg )
RelayTask* task = head->data;
g_slist_free( head );
gchar* strs = listTasks(storage->relayTaskList);
pthread_mutex_unlock( &storage->relayMutex );
XP_LOGF( "%s(): processing one of %d; created %d secs ago",
__func__, len, ((XP_U32)time(NULL)) - task->ctime );
XP_LOGF( "%s(): processing one of %d (%s); created %d secs ago",
__func__, len, strs, ((XP_U32)time(NULL)) - task->ctime );
g_free( strs );
switch ( task->typ ) {
case POST:

View file

@ -59,5 +59,5 @@ void relaycon_cleanup( LaunchParams* params );
XP_U32 makeClientToken( 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

View file

@ -478,10 +478,8 @@ update_ldevid() {
if [ $RNUM -lt 30 ]; then # upgrade or first run
CMD="--ldevid LINUX_TEST_$(printf %.5d ${KEY})_"
fi
else
if [ $RNUM -lt 10 ]; then
CMD="${CMD}x" # give it a new local ID
fi
elif [ $RNUM -lt 10 ]; then
CMD="${CMD}x" # give it a new local ID
fi
ARGS_DEVID[$KEY]="$CMD"
fi