java.lang.Object
net.i2p.sam.client.SAMClientEventListenerImpl
net.i2p.sam.client.SAMEventHandler
net.i2p.sam.client.SAMStreamSend.SendEventHandler
- All Implemented Interfaces:
SAMReader.SAMClientEventListener
- Enclosing class:
SAMStreamSend
Handles session events for the send.
Field Summary
Fields inherited from interface SAMReader.SAMClientEventListener
NAMING_REPLY_INVALID_KEY, NAMING_REPLY_KEY_NOT_FOUND, NAMING_REPLY_OK, SESSION_STATUS_DUPLICATE_DEST, SESSION_STATUS_I2P_ERROR, SESSION_STATUS_INVALID_KEY, SESSION_STATUS_OK, STREAM_CLOSED_CANT_REACH_PEER, STREAM_CLOSED_I2P_ERROR, STREAM_CLOSED_OK, STREAM_CLOSED_PEER_NOT_FOUND, STREAM_CLOSED_TIMEOUT, STREAM_STATUS_CANT_REACH_PEER, STREAM_STATUS_I2P_ERROR, STREAM_STATUS_INVALID_KEY, STREAM_STATUS_OK, STREAM_STATUS_TIMEOUTModifier and TypeFieldDescriptionstatic final StringNaming lookup failed because the private key is invalid.static final StringNaming lookup failed because no key matches the requested name.static final StringNaming lookup succeeded.static final StringSession creation failed because the destination is already in use.static final StringSESSION_STATUS_I2P_ERROR.static final StringSession creation failed because the supplied private key is invalid.static final StringSession creation succeeded.static final StringStream closed because the peer became unreachable.static final StringSTREAM_CLOSED_I2P_ERROR.static final StringStream closed normally.static final StringStream closed because the destination was no longer known to the router.static final StringStream closed because the lease expired.static final StringStream connect failed because the peer could not be reached.static final StringSTREAM_STATUS_I2P_ERROR.static final StringStream connect failed because the private key is invalid.static final StringStream connect succeeded.static final StringStream connect failed because the lease expired before it was established.Constructor Summary
ConstructorsConstructorDescriptionCreates the handler that tracks stream closes reported by the bridge.Method Summary
All MethodsModifier and TypeMethodDescriptionvoidstreamClosedReceived(String result, String id, String message) Drops the sender the bridge has just reported closed.Methods inherited from class SAMEventHandler
helloReplyReceived, namingReplyReceived, sessionStatusReceived, streamStatusReceived, unknownMessageReceived, waitForHelloReply, waitForNamingReply, waitForSessionAddReply, waitForSessionCreateReply, waitForStreamStatusReplyModifier and TypeMethodDescriptionvoidhelloReplyReceived(boolean ok, String version) Records the HELLO outcome and version, then wakes any waiter.voidnamingReplyReceived(String name, String result, String value, String msg) Files a naming reply under its name, value on success and result otherwise.voidsessionStatusReceived(String result, String destination, String msg) May be called twice, first for CREATE and second for ADD.voidstreamStatusReceived(String result, String id, String message) Records the session status result, then wakes any waiter.voidunknownMessageReceived(String major, String minor, Properties params) Logs a message this handler has no handling for.Wait for the connection to be established, returning the server version if everything went ok.waitForNamingReply(String name) Return the destination found matching the name, or null if the key was not able to be retrieved.booleanWait for the session to be added, returning true if everything went ok.booleanWait for the session to be created, returning true if everything went ok.booleanWait for the stream to be created, returning true if everything went ok.Methods inherited from class SAMClientEventListenerImpl
datagramReceived, destReplyReceived, pingReceived, pongReceived, rawReceived, streamConnectedReceived, streamDataReceivedModifier and TypeMethodDescriptionvoiddatagramReceived(String dest, byte[] data, int offset, int length, int fromPort, int toPort) Called when a datagram arrives.voiddestReplyReceived(String publicKey, String privateKey) Called when a DEST reply arrives.voidpingReceived(String data) Called when a PING reply arrives.voidpongReceived(String data) Called when a PONG reply arrives.voidrawReceived(byte[] data, int offset, int length, int fromPort, int toPort, int protocol) Called when a raw datagram arrives.voidstreamConnectedReceived(String remoteDestination, String id) Called when a STREAM CONNECTED reply arrives.voidstreamDataReceived(String id, byte[] data, int offset, int length) Called when data arrives on a stream.
Constructor Details
SendEventHandler
Creates the handler that tracks stream closes reported by the bridge.- Parameters:
ctx- the app context for the handler
Method Details
streamClosedReceived
Drops the sender the bridge has just reported closed.- Specified by:
streamClosedReceivedin interfaceSAMReader.SAMClientEventListener- Overrides:
streamClosedReceivedin classSAMClientEventListenerImpl- Parameters:
result- the close status, one of the STREAM_CLOSED_* constantsid- the stream ID of the stream that was closedmessage- the human-readable explanation supplied by the bridge