cleanup; don't list unack'd acks

This commit is contained in:
Eric House 2018-01-17 21:17:09 -08:00
parent 339779e88e
commit cdb22defcf

View file

@ -528,7 +528,10 @@ public class RelayService extends XWService
// DbgUtils.logf( "startFetchThreadIfNotUDP()" ); // DbgUtils.logf( "startFetchThreadIfNotUDP()" );
boolean handled = relayEnabled( this ) && !XWApp.UDP_ENABLED; boolean handled = relayEnabled( this ) && !XWApp.UDP_ENABLED;
if ( handled && null == m_fetchThread ) { if ( handled && null == m_fetchThread ) {
Assert.assertFalse( BuildConfig.DEBUG ); // NOT using this now!
m_fetchThread = new Thread( null, new Runnable() { m_fetchThread = new Thread( null, new Runnable() {
@Override
public void run() { public void run() {
fetchAndProcess(); fetchAndProcess();
m_fetchThread = null; m_fetchThread = null;
@ -799,7 +802,7 @@ public class RelayService extends XWService
return s_registered; return s_registered;
} }
private void requestMessagesImpl( XWRelayReg reg ) private void requestMessages()
{ {
try { try {
DevIDType[] typp = new DevIDType[1]; DevIDType[] typp = new DevIDType[1];
@ -808,26 +811,15 @@ public class RelayService extends XWService
ByteArrayOutputStream bas = new ByteArrayOutputStream(); ByteArrayOutputStream bas = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream( bas ); DataOutputStream out = new DataOutputStream( bas );
writeVLIString( out, devid ); writeVLIString( out, devid );
// Log.d( TAG, "requestMessagesImpl(): devid: %s; type: " + typp[0], devid ); postPacket( bas, XWRelayReg.XWPDEV_RQSTMSGS );
postPacket( bas, reg );
} else { } else {
Log.d(TAG, "requestMessagesImpl(): devid is null" ); Log.d(TAG, "requestMessages(): devid is null" );
} }
} catch ( java.io.IOException ioe ) { } catch ( java.io.IOException ioe ) {
Log.ex( TAG, ioe ); Log.ex( TAG, ioe );
} }
} }
private void requestMessages()
{
requestMessagesImpl( XWRelayReg.XWPDEV_RQSTMSGS );
}
// private void sendKeepAlive()
// {
// requestMessagesImpl( XWRelayReg.XWPDEV_KEEPALIVE );
// }
private void sendMessage( long rowid, byte[] msg ) private void sendMessage( long rowid, byte[] msg )
{ {
ByteArrayOutputStream bas = new ByteArrayOutputStream(); ByteArrayOutputStream bas = new ByteArrayOutputStream();
@ -971,6 +963,7 @@ public class RelayService extends XWService
private void fetchAndProcess() private void fetchAndProcess()
{ {
Assert.assertFalse( BuildConfig.DEBUG );
long[][] rowIDss = new long[1][]; long[][] rowIDss = new long[1][];
String[] relayIDs = DBUtils.getRelayIDs( this, rowIDss ); String[] relayIDs = DBUtils.getRelayIDs( this, rowIDss );
if ( null != relayIDs && 0 < relayIDs.length ) { if ( null != relayIDs && 0 < relayIDs.length ) {
@ -1443,13 +1436,16 @@ public class RelayService extends XWService
} else { } else {
Log.w( TAG, "Weird: got ack %d but never sent", packetID ); Log.w( TAG, "Weird: got ack %d but never sent", packetID );
} }
if ( BuildConfig.DEBUG ) { if ( BuildConfig.DEBUG ) {
ArrayList<String> pstrs = new ArrayList<>(); ArrayList<String> pstrs = new ArrayList<>();
for ( PacketData datum : map ) { for ( PacketData datum : map ) {
pstrs.add( String.format("%d", datum.m_packetID ) ); if ( 0 != datum.m_packetID ) {
pstrs.add( String.format("%d", datum.m_packetID ) );
}
} }
Log.d( TAG, "noteAck(fromUDP=%b): Got ack for %d; there are %d unacked packets: %s", Log.d( TAG, "noteAck(fromUDP=%b): Got ack for %d; there are %d unacked packets: %s",
fromUDP, packetID, map.size(), TextUtils.join( ",", pstrs ) ); fromUDP, packetID, pstrs.size(), TextUtils.join( ",", pstrs ) );
} }
} }