Merge remote branch 'origin/android_branch' into android_branch

This commit is contained in:
Eric House 2013-09-27 05:46:43 -07:00
commit 945c41c615
5 changed files with 35 additions and 3 deletions

View file

@ -58,7 +58,7 @@
<target name="-pre-build">
<property name="CHAT_ENABLED" value="true" />
<exec dir="." executable="../scripts/ndkbuild.sh" >
<exec dir="." executable="../scripts/ndkbuild.sh" failonerror="true">
<arg value="BUILD_TARGET=${build.target}" />
<arg value="-j3"/>
<arg value="INITIAL_CLIENT_VERS=${INITIAL_CLIENT_VERS}" />

View file

@ -91,6 +91,7 @@ relaycon_reg( LaunchParams* params, const XP_UCHAR* rDevID,
indx += writeHeader( storage, tmpbuf, XWPDEV_REG );
indx += addVLIStr( &tmpbuf[indx], sizeof(tmpbuf) - indx, rDevID );
assert( ID_TYPE_RELAY != typ );
tmpbuf[indx++] = typ;
if ( ID_TYPE_NONE != typ ) {
indx += writeDevID( &tmpbuf[indx], sizeof(tmpbuf) - indx, devID );

View file

@ -1188,6 +1188,25 @@ CookieRef::sendAnyStored( const CRefEvent* evt )
}
}
typedef struct _StoreData {
string connName;
HostID dest;
uint8_t* buf;
int buflen;
} StoreData;
void
CookieRef::storeNoAck( bool acked, uint32_t packetID, void* data )
{
StoreData* sdata = (StoreData*)data;
if ( !acked ) {
DBMgr::Get()->StoreMessage( sdata->connName.c_str(), sdata->dest,
sdata->buf, sdata->buflen );
}
free( sdata->buf );
free( sdata );
}
void
CookieRef::forward_or_store( const CRefEvent* evt )
{
@ -1214,9 +1233,19 @@ CookieRef::forward_or_store( const CRefEvent* evt )
usleep( m_delayMicros );
}
uint32_t packetID = 0;
if ( (NULL == destAddr)
|| !send_with_length( destAddr, dest, buf, buflen, true ) ) {
|| !send_with_length( destAddr, dest, buf, buflen, true,
&packetID ) ) {
store_message( dest, buf, buflen );
} else if ( 0 != packetID ) { // sent via UDP
StoreData* data = new StoreData;
data->connName = m_connName;
data->dest = dest;
data->buf = (uint8_t*)malloc( buflen );
memcpy( data->buf, buf, buflen );
data->buflen = buflen;
UDPAckTrack::setOnAck( storeNoAck, packetID, data );
}
// If recipient GAME isn't connected, see if owner device is and can

View file

@ -250,6 +250,8 @@ class CookieRef {
void setAckTimer( HostID hid );
void cancelAckTimer( HostID hid );
static void storeNoAck( bool acked, uint32_t packetID, void* data );
void forward_or_store( const CRefEvent* evt );
void send_denied( const CRefEvent* evt, XWREASON why );
void send_trytell( const CRefEvent* evt );

View file

@ -1504,7 +1504,7 @@ registerDevice( const string& relayIDStr, const DevID* devID,
if ( DBMgr::DEVID_NONE == relayID ) { // new device
relayID = dbMgr->RegisterDevice( devID, clientVers, devDesc.c_str(),
model.c_str(), osVers.c_str() );
} else if ( ID_TYPE_NONE != devID->m_devIDType ) { // re-registering
} else if ( ID_TYPE_RELAY < devID->m_devIDType ) { // re-registering
dbMgr->ReregisterDevice( relayID, devID, devDesc.c_str(), clientVers,
model.c_str(), osVers.c_str() );
checkMsgs = true;