add a bit of logging

This commit is contained in:
Eric House 2016-11-28 07:40:09 -08:00
parent 2fa47f057d
commit 1a513e8b02
2 changed files with 11 additions and 5 deletions

View file

@ -97,7 +97,7 @@ public class BiDiSockWrap {
public boolean isConnected() { return null != getSocket(); }
public void send( String packet )
private void send( String packet )
{
try {
send( packet.getBytes( "UTF-8" ) );
@ -114,7 +114,8 @@ public class BiDiSockWrap {
public void send( byte[] packet )
{
Assert.assertNotNull( packet );
mQueue.add(packet);
Assert.assertTrue( packet.length > 0 );
mQueue.add( packet );
}
private void init( Socket socket )
@ -126,6 +127,7 @@ public class BiDiSockWrap {
private void closeSocket()
{
DbgUtils.logd( TAG, "closeSocket()" );
mRunThreads = false;
mActive = false;
try {

View file

@ -179,6 +179,7 @@ public class WiDirService extends XWService {
public static void init( Context context )
{
DbgUtils.logd( TAG, "init()" );
ChannelListener listener = new ChannelListener() {
@Override
public void onChannelDisconnected() {
@ -344,9 +345,11 @@ public class WiDirService extends XWService {
processPacket( socket, bytes );
}
public void connectStateChanged( BiDiSockWrap wrap, boolean nowConnected )
public void connectStateChanged( BiDiSockWrap wrap,
boolean nowConnected )
{
DbgUtils.logd( TAG, "connectStateChanged(con=%b)", nowConnected );
DbgUtils.logd( TAG, "connectStateChanged(connected=%b)",
nowConnected );
if ( nowConnected ) {
try {
wrap.send( new JSONObject()
@ -872,7 +875,7 @@ public class WiDirService extends XWService {
}
} catch ( IOException ioe ) {
sAmServer = false;
DbgUtils.logex( ioe );
DbgUtils.loge( TAG, ioe.toString() );
}
DbgUtils.logd( TAG, "accept thread exiting" );
}
@ -882,6 +885,7 @@ public class WiDirService extends XWService {
private static void stopAcceptThread()
{
DbgUtils.logd( TAG, "stopAcceptThread()" );
if ( null != sAcceptThread ) {
if ( null != sServerSock ) {
try {