Merge remote-tracking branch 'origin/android_branch' into android_branch

This commit is contained in:
Eric House 2013-07-05 21:21:19 -07:00
commit 7ecaf76b22
4 changed files with 30 additions and 20 deletions

View file

@ -45,6 +45,7 @@ OBJ = $(patsubst %.cpp,%.o,$(SRC))
LDFLAGS += -pthread -g $(STATIC)
LDFLAGS += -L$(shell pg_config --libdir)
LDFLAGS += $(shell pkg-config --libs glib-2.0)
LDFLAGS += -lrt
CPPFLAGS += -DSPAWN_SELF -g -Wall
CPPFLAGS += -I $(shell pg_config --includedir)

View file

@ -857,12 +857,11 @@ void
CookieRef::send_stored_messages( HostID dest, const AddrInfo* addr )
{
logf( XW_LOGVERBOSE0, "%s(dest=%d)", __func__, dest );
assert( dest > 0 && dest <= 4 );
if ( addr->isCurrent() ) {
DBMgr* dbmgr = DBMgr::Get();
const char* cname = ConnName();
for ( ; ; ) {
while ( addr->isCurrent() ) {
unsigned char buf[MAX_MSG_LEN];
size_t buflen = sizeof(buf);
int msgID;
@ -872,7 +871,6 @@ CookieRef::send_stored_messages( HostID dest, const AddrInfo* addr )
}
dbmgr->RemoveStoredMessages( &msgID, 1 );
}
}
} /* send_stored_messages */
bool

View file

@ -65,6 +65,7 @@ DBMgr::DBMgr()
int tmp;
RelayConfigs::GetConfigs()->GetValueFor( "USE_B64", &tmp );
m_useB64 = tmp != 0;
logf( XW_LOGINFO, "%s: m_useB64=%d", __func__, m_useB64 );
pthread_key_create( &m_conn_key, destr_function );
@ -1099,7 +1100,6 @@ DBMgr::getCountWhere( const char* table, string& test )
assert( 1 == PQntuples( result ) );
int count = atoi( PQgetvalue( result, 0, 0 ) );
PQclear( result );
logf( XW_LOGINFO, "%s(%s)=>%d", __func__, query.c_str(), count );
return count;
}

View file

@ -203,13 +203,24 @@ parseRelayID( const unsigned char** const inp, const unsigned char* const end,
if ( ok ) {
strncpy( buf, (char*)*inp, connNameLen );
buf[connNameLen] = '\0';
*hid = atoi( hidp+1 );
char* endptr;
*hid = strtol( hidp + 1, &endptr, 10 );
if ( *hid >= 0 && *hid <= 4 ) {
if ( '\n' == *endptr ) {
++endptr;
}
*inp = (unsigned char*)endptr;
} else {
ok = false;
int len = end - *inp;
char buf[len+1];
memcpy( buf, *inp, len);
buf[len] = '\0';
logf( XW_LOGERROR, "%s: got bad hid %d from str \"%s\"", __func__,
*hid, buf );
}
}
if ( !ok ) {
logf( XW_LOGERROR, "%s failed", __func__ );