Package net.i2p.router.client
Class ClientMessageEventListener
- java.lang.Object
-
- net.i2p.router.client.ClientMessageEventListener
-
- All Implemented Interfaces:
I2CPMessageReader.I2CPMessageEventListener
class ClientMessageEventListener extends Object implements I2CPMessageReader.I2CPMessageEventListener
Receive events from the client and handle them accordingly (updating the runner when necessary)
-
-
Field Summary
Fields Modifier and Type Field Description protected RouterContext
_context
protected ClientConnectionRunner
_runner
-
Constructor Summary
Constructors Constructor Description ClientMessageEventListener(RouterContext context, ClientConnectionRunner runner, boolean enforceAuth)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
disconnected(I2CPMessageReader reader)
Notify the listener that the stream this reader was reading was closed.protected void
handleCreateLeaseSet(CreateLeaseSetMessage message)
override for testingprotected void
handleDestLookup(DestLookupMessage message)
override for testingprotected void
handleGetBWLimits(GetBandwidthLimitsMessage message)
Divide router limit by 1.75 for overhead.protected void
handleHostLookup(HostLookupMessage message)
override for testingvoid
messageReceived(I2CPMessageReader reader, I2CPMessage message)
Handle an incoming message and dispatch it to the appropriate handlervoid
readError(I2CPMessageReader reader, Exception error)
Handle notification that there was an errorprotected void
startCreateSessionJob(SessionConfig config)
Override for testing
-
-
-
Field Detail
-
_context
protected final RouterContext _context
-
_runner
protected final ClientConnectionRunner _runner
-
-
Constructor Detail
-
ClientMessageEventListener
public ClientMessageEventListener(RouterContext context, ClientConnectionRunner runner, boolean enforceAuth)
- Parameters:
enforceAuth
- set false for in-JVM, true for socket access
-
-
Method Detail
-
messageReceived
public void messageReceived(I2CPMessageReader reader, I2CPMessage message)
Handle an incoming message and dispatch it to the appropriate handler- Specified by:
messageReceived
in interfaceI2CPMessageReader.I2CPMessageEventListener
- Parameters:
reader
- I2CPMessageReader to notifymessage
- the I2CPMessage
-
readError
public void readError(I2CPMessageReader reader, Exception error)
Handle notification that there was an error- Specified by:
readError
in interfaceI2CPMessageReader.I2CPMessageEventListener
- Parameters:
reader
- I2CPMessageReader to notifyerror
- Exception that was thrown, non-null
-
disconnected
public void disconnected(I2CPMessageReader reader)
Description copied from interface:I2CPMessageReader.I2CPMessageEventListener
Notify the listener that the stream this reader was reading was closed. For most errors, readError() will be called first, as of 0.9.41- Specified by:
disconnected
in interfaceI2CPMessageReader.I2CPMessageEventListener
- Parameters:
reader
- I2CPMessageReader to notify
-
startCreateSessionJob
protected void startCreateSessionJob(SessionConfig config)
Override for testing- Since:
- 0.9.8
-
handleCreateLeaseSet
protected void handleCreateLeaseSet(CreateLeaseSetMessage message)
override for testing
-
handleDestLookup
protected void handleDestLookup(DestLookupMessage message)
override for testing
-
handleHostLookup
protected void handleHostLookup(HostLookupMessage message)
override for testing- Since:
- 0.9.11
-
handleGetBWLimits
protected void handleGetBWLimits(GetBandwidthLimitsMessage message)
Divide router limit by 1.75 for overhead. This could someday give a different answer to each client. But it's not enforced anywhere. protected for unit test override
-
-