mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Massive refactoring to merge handling of simplex and duplex connections.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package org.briarproject.api.messaging;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
void interrupt();
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.briarproject.api.messaging;
|
||||
|
||||
import org.briarproject.api.plugins.TransportConnectionReader;
|
||||
import org.briarproject.api.plugins.TransportConnectionWriter;
|
||||
import org.briarproject.api.transport.StreamContext;
|
||||
|
||||
public interface MessagingSessionFactory {
|
||||
|
||||
MessagingSession createIncomingSession(StreamContext ctx,
|
||||
TransportConnectionReader r);
|
||||
|
||||
MessagingSession createOutgoingSession(StreamContext ctx,
|
||||
TransportConnectionWriter w, boolean duplex);
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.briarproject.api.messaging.duplex;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.plugins.duplex.DuplexTransportConnection;
|
||||
import org.briarproject.api.transport.StreamContext;
|
||||
|
||||
public interface DuplexConnectionFactory {
|
||||
|
||||
void createIncomingConnection(StreamContext ctx,
|
||||
DuplexTransportConnection d);
|
||||
|
||||
void createOutgoingConnection(ContactId c, TransportId t,
|
||||
DuplexTransportConnection d);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.briarproject.api.messaging.simplex;
|
||||
|
||||
import org.briarproject.api.ContactId;
|
||||
import org.briarproject.api.TransportId;
|
||||
import org.briarproject.api.plugins.simplex.SimplexTransportReader;
|
||||
import org.briarproject.api.plugins.simplex.SimplexTransportWriter;
|
||||
import org.briarproject.api.transport.StreamContext;
|
||||
|
||||
public interface SimplexConnectionFactory {
|
||||
|
||||
void createIncomingConnection(StreamContext ctx,
|
||||
SimplexTransportReader r);
|
||||
|
||||
void createOutgoingConnection(ContactId c, TransportId t,
|
||||
SimplexTransportWriter w);
|
||||
}
|
||||
Reference in New Issue
Block a user