net.i2p.client.streaming
class ConnectionManager extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
ConnectionManager.PingNotifier |
Constructor and Description |
---|
ConnectionManager(I2PAppContext context,
I2PSession session,
int maxConcurrent,
ConnectionOptions defaultOptions) |
Modifier and Type | Method and Description |
---|---|
boolean |
answerPings()
do we respond to pings that aren't on an existing connection?
|
Connection |
connect(Destination peer,
ConnectionOptions opts)
Build a new connection to the given peer.
|
void |
disconnectAllHard()
Something b0rked hard, so kill all of our connections without mercy.
|
boolean |
getAllowIncomingConnections() |
(package private) Connection |
getConnectionByInboundId(long id) |
(package private) Connection |
getConnectionByOutboundId(long id)
not guaranteed to be unique, but in case we receive more than one packet
on an inbound connection that we havent ack'ed yet...
|
ConnectionHandler |
getConnectionHandler() |
MessageHandler |
getMessageHandler() |
PacketHandler |
getPacketHandler() |
PacketQueue |
getPacketQueue() |
I2PSession |
getSession() |
long |
getSoTimeout()
Get the socket accept() timeout.
|
Set<Connection> |
listConnections()
return a set of Connection objects
|
boolean |
ping(Destination peer,
long timeoutMs)
blocking
|
boolean |
ping(Destination peer,
long timeoutMs,
boolean blocking) |
boolean |
ping(Destination peer,
long timeoutMs,
boolean blocking,
ConnectionManager.PingNotifier notifier) |
boolean |
ping(Destination peer,
long timeoutMs,
boolean blocking,
SessionKey keyToUse,
Set tagsToSend,
ConnectionManager.PingNotifier notifier)
Deprecated.
I2PSession ignores tags, use non-tag variant
|
Connection |
receiveConnection(Packet synPacket)
Create a new connection based on the SYN packet we received.
|
(package private) void |
receivePong(long pingId) |
void |
removeConnection(Connection con)
Drop the (already closed) connection on the floor.
|
void |
setAllowIncomingConnections(boolean allow) |
void |
setSoTimeout(long x)
Set the socket accept() timeout.
|
void |
updateOptsFromShare(Connection con) |
void |
updateShareOpts(Connection con) |
public ConnectionManager(I2PAppContext context, I2PSession session, int maxConcurrent, ConnectionOptions defaultOptions)
Connection getConnectionByInboundId(long id)
Connection getConnectionByOutboundId(long id)
public void setSoTimeout(long x)
x
- public long getSoTimeout()
public void setAllowIncomingConnections(boolean allow)
public boolean getAllowIncomingConnections()
public Connection receiveConnection(Packet synPacket)
synPacket
- SYN packet to processpublic Connection connect(Destination peer, ConnectionOptions opts)
peer
- Destination to contactopts
- Connection's optionspublic MessageHandler getMessageHandler()
public PacketHandler getPacketHandler()
public I2PSession getSession()
public void updateOptsFromShare(Connection con)
public void updateShareOpts(Connection con)
public ConnectionHandler getConnectionHandler()
public PacketQueue getPacketQueue()
public boolean answerPings()
public void disconnectAllHard()
public void removeConnection(Connection con)
con
- Connection to drop.public Set<Connection> listConnections()
public boolean ping(Destination peer, long timeoutMs)
public boolean ping(Destination peer, long timeoutMs, boolean blocking)
public boolean ping(Destination peer, long timeoutMs, boolean blocking, SessionKey keyToUse, Set tagsToSend, ConnectionManager.PingNotifier notifier)
keyToUse
- ignoredtagsToSend
- ignoredpublic boolean ping(Destination peer, long timeoutMs, boolean blocking, ConnectionManager.PingNotifier notifier)
void receivePong(long pingId)