Package com.biglybt.core.proxy.impl
Class AEProxyConnectionImpl
- java.lang.Object
-
- com.biglybt.core.proxy.impl.AEProxyConnectionImpl
-
- All Implemented Interfaces:
AEProxyConnection
public class AEProxyConnectionImpl extends java.lang.Object implements AEProxyConnection
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
is_closed
protected boolean
is_connected
protected java.util.List
listeners
private static LogIDs
LOGID
protected AEProxyState
proxy_connect_state
protected AEProxyState
proxy_read_state
protected AEProxyState
proxy_write_state
protected AEProxyImpl
server
protected java.nio.channels.SocketChannel
source_channel
protected long
time_stamp
-
Constructor Summary
Constructors Modifier Constructor Description protected
AEProxyConnectionImpl(AEProxyImpl _server, java.nio.channels.SocketChannel _socket, AEProxyHandler _handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(AEProxyConnectionListener l)
void
cancelConnectSelect(java.nio.channels.SocketChannel sc)
void
cancelReadSelect(java.nio.channels.SocketChannel sc)
void
cancelWriteSelect(java.nio.channels.SocketChannel sc)
void
close()
close the connectionprotected boolean
connect(java.nio.channels.SocketChannel sc)
void
failed(java.lang.Throwable reason)
indicate that the connection has failedjava.lang.String
getName()
java.nio.channels.SocketChannel
getSourceChannel()
returns the non-blocking channel associated with the initiator of this proxy connectionprotected java.lang.String
getStateString()
protected long
getTimeStamp()
boolean
isClosed()
protected boolean
isConnected()
protected boolean
read(java.nio.channels.SocketChannel sc)
void
removeListener(AEProxyConnectionListener l)
void
requestConnectSelect(java.nio.channels.SocketChannel sc)
void
requestReadSelect(java.nio.channels.SocketChannel sc)
void
requestWriteSelect(java.nio.channels.SocketChannel sc)
void
setConnected()
marks the transition between connecting and connectedvoid
setConnectState(AEProxyState state)
void
setReadState(AEProxyState state)
void
setTimeStamp()
marks the last time that something happened on the connection for read timeout purposesvoid
setWriteState(AEProxyState state)
protected boolean
write(java.nio.channels.SocketChannel sc)
-
-
-
Field Detail
-
LOGID
private static final LogIDs LOGID
-
server
protected final AEProxyImpl server
-
source_channel
protected final java.nio.channels.SocketChannel source_channel
-
proxy_read_state
protected volatile AEProxyState proxy_read_state
-
proxy_write_state
protected volatile AEProxyState proxy_write_state
-
proxy_connect_state
protected volatile AEProxyState proxy_connect_state
-
time_stamp
protected long time_stamp
-
is_connected
protected boolean is_connected
-
is_closed
protected boolean is_closed
-
listeners
protected final java.util.List listeners
-
-
Constructor Detail
-
AEProxyConnectionImpl
protected AEProxyConnectionImpl(AEProxyImpl _server, java.nio.channels.SocketChannel _socket, AEProxyHandler _handler)
-
-
Method Detail
-
getName
public java.lang.String getName()
- Specified by:
getName
in interfaceAEProxyConnection
-
getSourceChannel
public java.nio.channels.SocketChannel getSourceChannel()
Description copied from interface:AEProxyConnection
returns the non-blocking channel associated with the initiator of this proxy connection- Specified by:
getSourceChannel
in interfaceAEProxyConnection
- Returns:
-
setReadState
public void setReadState(AEProxyState state)
- Specified by:
setReadState
in interfaceAEProxyConnection
-
setWriteState
public void setWriteState(AEProxyState state)
- Specified by:
setWriteState
in interfaceAEProxyConnection
-
setConnectState
public void setConnectState(AEProxyState state)
- Specified by:
setConnectState
in interfaceAEProxyConnection
-
read
protected boolean read(java.nio.channels.SocketChannel sc)
-
write
protected boolean write(java.nio.channels.SocketChannel sc)
-
connect
protected boolean connect(java.nio.channels.SocketChannel sc)
-
requestWriteSelect
public void requestWriteSelect(java.nio.channels.SocketChannel sc)
- Specified by:
requestWriteSelect
in interfaceAEProxyConnection
-
cancelWriteSelect
public void cancelWriteSelect(java.nio.channels.SocketChannel sc)
- Specified by:
cancelWriteSelect
in interfaceAEProxyConnection
-
requestConnectSelect
public void requestConnectSelect(java.nio.channels.SocketChannel sc)
- Specified by:
requestConnectSelect
in interfaceAEProxyConnection
-
cancelConnectSelect
public void cancelConnectSelect(java.nio.channels.SocketChannel sc)
- Specified by:
cancelConnectSelect
in interfaceAEProxyConnection
-
requestReadSelect
public void requestReadSelect(java.nio.channels.SocketChannel sc)
- Specified by:
requestReadSelect
in interfaceAEProxyConnection
-
cancelReadSelect
public void cancelReadSelect(java.nio.channels.SocketChannel sc)
- Specified by:
cancelReadSelect
in interfaceAEProxyConnection
-
failed
public void failed(java.lang.Throwable reason)
Description copied from interface:AEProxyConnection
indicate that the connection has failed- Specified by:
failed
in interfaceAEProxyConnection
-
close
public void close()
Description copied from interface:AEProxyConnection
close the connection- Specified by:
close
in interfaceAEProxyConnection
-
isClosed
public boolean isClosed()
- Specified by:
isClosed
in interfaceAEProxyConnection
-
setConnected
public void setConnected()
Description copied from interface:AEProxyConnection
marks the transition between connecting and connected- Specified by:
setConnected
in interfaceAEProxyConnection
-
isConnected
protected boolean isConnected()
-
setTimeStamp
public void setTimeStamp()
Description copied from interface:AEProxyConnection
marks the last time that something happened on the connection for read timeout purposes- Specified by:
setTimeStamp
in interfaceAEProxyConnection
-
getTimeStamp
protected long getTimeStamp()
-
addListener
public void addListener(AEProxyConnectionListener l)
- Specified by:
addListener
in interfaceAEProxyConnection
-
removeListener
public void removeListener(AEProxyConnectionListener l)
- Specified by:
removeListener
in interfaceAEProxyConnection
-
getStateString
protected java.lang.String getStateString()
-
-