mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-31 19:57:06 +01:00
wrap a bunch of tcp-connection code in !XWApp.UDP_ENABLED so compiler
can make it go away.
This commit is contained in:
parent
107ba4c940
commit
8ab832a136
1 changed files with 164 additions and 154 deletions
|
@ -82,6 +82,7 @@ public class CommsTransport implements TransportProcs,
|
|||
@Override
|
||||
public void run()
|
||||
{
|
||||
if ( !XWApp.UDP_ENABLED ) {
|
||||
m_done = false;
|
||||
boolean failed = true;
|
||||
try {
|
||||
|
@ -108,10 +109,12 @@ public class CommsTransport implements TransportProcs,
|
|||
m_jniThread.handle( JNICmd.CMD_TRANSFAIL );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean loop()
|
||||
{
|
||||
boolean failed = false;
|
||||
if ( !XWApp.UDP_ENABLED ) {
|
||||
outer_loop:
|
||||
while ( !m_done ) {
|
||||
try {
|
||||
|
@ -208,6 +211,7 @@ public class CommsTransport implements TransportProcs,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return failed;
|
||||
} // loop
|
||||
}
|
||||
|
@ -254,6 +258,7 @@ public class CommsTransport implements TransportProcs,
|
|||
|
||||
private synchronized void putOut( final byte[] buf )
|
||||
{
|
||||
if ( !XWApp.UDP_ENABLED ) {
|
||||
int len = buf.length;
|
||||
ByteBuffer netbuf = ByteBuffer.allocate( len + 2 );
|
||||
netbuf.putShort( (short)len );
|
||||
|
@ -266,10 +271,11 @@ public class CommsTransport implements TransportProcs,
|
|||
m_selector.wakeup(); // getting NPE inside here -- see below
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void closeSocket()
|
||||
{
|
||||
if ( null != m_socketChannel ) {
|
||||
if ( !XWApp.UDP_ENABLED && null != m_socketChannel ) {
|
||||
try {
|
||||
m_socketChannel.close();
|
||||
} catch ( Exception e ) {
|
||||
|
@ -309,6 +315,7 @@ public class CommsTransport implements TransportProcs,
|
|||
|
||||
private void addIncoming( )
|
||||
{
|
||||
if ( !XWApp.UDP_ENABLED ) {
|
||||
m_bytesIn.flip();
|
||||
|
||||
for ( ; ; ) {
|
||||
|
@ -340,9 +347,11 @@ public class CommsTransport implements TransportProcs,
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void waitToStopImpl()
|
||||
{
|
||||
if ( !XWApp.UDP_ENABLED ) {
|
||||
m_done = true; // this is in a race!
|
||||
if ( null != m_selector ) {
|
||||
m_selector.wakeup(); // getting NPE inside here -- see below
|
||||
|
@ -356,6 +365,7 @@ public class CommsTransport implements TransportProcs,
|
|||
m_thread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TransportProcs interface
|
||||
|
||||
|
@ -373,7 +383,7 @@ public class CommsTransport implements TransportProcs,
|
|||
addr = faddr;
|
||||
}
|
||||
|
||||
if ( null == m_relayAddr ) {
|
||||
if ( !XWApp.UDP_ENABLED && null == m_relayAddr ) {
|
||||
m_relayAddr = new CommsAddrRec( addr );
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue