Massive refactoring to merge handling of simplex and duplex connections.

This commit is contained in:
akwizgran
2014-11-04 16:51:25 +00:00
parent b24f153704
commit 7b8181e309
67 changed files with 1981 additions and 2288 deletions

View File

@@ -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();
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}