Interrupt messaging session if contact or transport is removed.

This commit is contained in:
akwizgran
2014-11-06 08:10:29 +00:00
parent c202b6f0ac
commit 852a618cb3
10 changed files with 178 additions and 123 deletions

View File

@@ -6,14 +6,13 @@ public interface MessagingSession {
/**
* Runs the session. This method returns when there are no more packets to
* send or when the {@link #interrupt()} method has been called.
* send or receive, or when the {@link #interrupt()} method has been called.
*/
void run() throws IOException;
/**
* Interrupts the session, causing the {@link #run()} method to return at
* the next opportunity or throw an {@link java.io.IOException IOException}
* if it cannot return cleanly.
* the next opportunity.
*/
void interrupt();
}

View File

@@ -8,8 +8,9 @@ import org.briarproject.api.TransportId;
public interface MessagingSessionFactory {
MessagingSession createIncomingSession(ContactId c, InputStream in);
MessagingSession createIncomingSession(ContactId c, TransportId t,
InputStream in);
MessagingSession createOutgoingSession(ContactId c, TransportId t,
long maxLatency, OutputStream out, boolean duplex);
long maxLatency, boolean duplex, OutputStream out);
}