mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-04 20:46:28 +01:00
log unack'd packets
This commit is contained in:
parent
0d8aef06f3
commit
503702c0e4
1 changed files with 19 additions and 10 deletions
|
@ -26,6 +26,7 @@ import android.content.Intent;
|
|||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
|
@ -740,10 +741,12 @@ public class RelayService extends XWService
|
|||
int pid = packet.m_packetID;
|
||||
Log.d( TAG, "Sent [udp?] packet: cmd=%s, id=%d",
|
||||
packet.m_cmd.toString(), pid);
|
||||
if ( packet.m_cmd != XWRelayReg.XWPDEV_ACK ) {
|
||||
synchronized( s_packetsSent ) {
|
||||
s_packetsSent.put( pid, packet );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void noteSent( List<PacketData> packets )
|
||||
{
|
||||
|
@ -1313,14 +1316,20 @@ public class RelayService extends XWService
|
|||
PacketData packet;
|
||||
synchronized( s_packetsSent ) {
|
||||
packet = s_packetsSent.remove( packetID );
|
||||
}
|
||||
if ( packet != null ) {
|
||||
Log.w( TAG, "noteAck(): removed for id %d: %s", packetID, packet );
|
||||
Log.d( TAG, "noteAck(): removed for id %d: %s", packetID, packet );
|
||||
} else {
|
||||
Log.w( TAG, "Weird: got ack %d but never sent", packetID );
|
||||
}
|
||||
Log.d( TAG, "noteAck(): Got ack for %d; there are %d unacked packets",
|
||||
packetID, s_packetsSent.size() );
|
||||
if ( BuildConfig.DEBUG ) {
|
||||
ArrayList<String> pstrs = new ArrayList<>();
|
||||
for ( Integer pkid : s_packetsSent.keySet() ) {
|
||||
pstrs.add( s_packetsSent.get(pkid).toString() );
|
||||
}
|
||||
Log.d( TAG, "noteAck(): Got ack for %d; there are %d unacked packets: %s",
|
||||
packetID, s_packetsSent.size(), TextUtils.join( ",", pstrs ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Called from any thread
|
||||
|
@ -1541,7 +1550,7 @@ public class RelayService extends XWService
|
|||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.format( "cmd: %s; age: %d ms", m_cmd,
|
||||
return String.format( "{cmd: %s; age: %d ms}", m_cmd,
|
||||
System.currentTimeMillis() - m_created );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue