Package com.biglybt.core.proxy.impl
Class AEProxyImpl
- java.lang.Object
-
- com.biglybt.core.proxy.impl.AEProxyImpl
-
- All Implemented Interfaces:
VirtualChannelSelector.VirtualAbstractSelectorListener
,VirtualChannelSelector.VirtualSelectorListener
,AEProxy
public class AEProxyImpl extends java.lang.Object implements AEProxy, VirtualChannelSelector.VirtualSelectorListener
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
allow_external_access
(package private) VirtualChannelSelector
connect_selector
private long
connect_timeout
private static int
DEBUG_PERIOD
private boolean
destroyed
private long
last_debug
private static LogIDs
LOGID
private int
port
private java.util.List<AEProxyConnectionImpl>
processors
private AEProxyHandler
proxy_handler
(package private) VirtualChannelSelector
read_selector
private long
read_timeout
private java.nio.channels.ServerSocketChannel
ssc
private AEMonitor
this_mon
private java.util.HashMap
write_select_regs
(package private) VirtualChannelSelector
write_selector
-
Constructor Summary
Constructors Constructor Description AEProxyImpl(int _port, long _connect_timeout, long _read_timeout, AEProxyHandler _proxy_handler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
acceptLoop(java.nio.channels.ServerSocketChannel ssc)
protected void
cancelConnectSelect(java.nio.channels.SocketChannel sc)
protected void
cancelReadSelect(java.nio.channels.SocketChannel sc)
protected void
cancelWriteSelect(java.nio.channels.SocketChannel sc)
protected void
checkTimeouts()
protected void
close(AEProxyConnectionImpl processor)
void
destroy()
int
getPort()
protected void
requestConnectSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
protected void
requestReadSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
protected void
requestWriteSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
void
selectFailure(VirtualChannelSelector selector, java.nio.channels.SocketChannel sc, java.lang.Object attachment, java.lang.Throwable msg)
Called when a channel selection fails.protected void
selectLoop(VirtualChannelSelector selector)
boolean
selectSuccess(VirtualChannelSelector selector, java.nio.channels.SocketChannel sc, java.lang.Object attachment)
Called when a channel is successfully selected for readyness.void
setAllowExternalConnections(boolean permit)
-
-
-
Field Detail
-
LOGID
private static final LogIDs LOGID
-
DEBUG_PERIOD
private static final int DEBUG_PERIOD
- See Also:
- Constant Field Values
-
last_debug
private long last_debug
-
port
private int port
-
connect_timeout
private final long connect_timeout
-
read_timeout
private final long read_timeout
-
proxy_handler
private final AEProxyHandler proxy_handler
-
ssc
private java.nio.channels.ServerSocketChannel ssc
-
read_selector
final VirtualChannelSelector read_selector
-
connect_selector
final VirtualChannelSelector connect_selector
-
write_selector
final VirtualChannelSelector write_selector
-
processors
private final java.util.List<AEProxyConnectionImpl> processors
-
write_select_regs
private final java.util.HashMap write_select_regs
-
allow_external_access
private boolean allow_external_access
-
this_mon
private final AEMonitor this_mon
-
destroyed
private volatile boolean destroyed
-
-
Constructor Detail
-
AEProxyImpl
public AEProxyImpl(int _port, long _connect_timeout, long _read_timeout, AEProxyHandler _proxy_handler) throws AEProxyException
- Throws:
AEProxyException
-
-
Method Detail
-
setAllowExternalConnections
public void setAllowExternalConnections(boolean permit)
- Specified by:
setAllowExternalConnections
in interfaceAEProxy
-
acceptLoop
protected void acceptLoop(java.nio.channels.ServerSocketChannel ssc)
-
close
protected void close(AEProxyConnectionImpl processor)
-
selectLoop
protected void selectLoop(VirtualChannelSelector selector)
-
checkTimeouts
protected void checkTimeouts()
-
requestWriteSelect
protected void requestWriteSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
-
cancelWriteSelect
protected void cancelWriteSelect(java.nio.channels.SocketChannel sc)
-
requestReadSelect
protected void requestReadSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
-
cancelReadSelect
protected void cancelReadSelect(java.nio.channels.SocketChannel sc)
-
requestConnectSelect
protected void requestConnectSelect(AEProxyConnectionImpl processor, java.nio.channels.SocketChannel sc)
-
cancelConnectSelect
protected void cancelConnectSelect(java.nio.channels.SocketChannel sc)
-
selectSuccess
public boolean selectSuccess(VirtualChannelSelector selector, java.nio.channels.SocketChannel sc, java.lang.Object attachment)
Description copied from interface:VirtualChannelSelector.VirtualSelectorListener
Called when a channel is successfully selected for readyness.- Specified by:
selectSuccess
in interfaceVirtualChannelSelector.VirtualSelectorListener
attachment
- originally given with the channel's registration- Returns:
- indicator of whether or not any 'progress' was made due to this select null -> progress made, String -> location of non progress e.g. read-select -> read >0 bytes, write-select -> wrote > 0 bytes
-
selectFailure
public void selectFailure(VirtualChannelSelector selector, java.nio.channels.SocketChannel sc, java.lang.Object attachment, java.lang.Throwable msg)
Description copied from interface:VirtualChannelSelector.VirtualSelectorListener
Called when a channel selection fails.- Specified by:
selectFailure
in interfaceVirtualChannelSelector.VirtualSelectorListener
msg
- failure message
-
-