Read the tag on a connection recogniser thread, don't block the

plugin.
This commit is contained in:
akwizgran
2011-12-08 16:33:48 +00:00
parent 6e080bb35d
commit e3242ebb06
6 changed files with 83 additions and 131 deletions

View File

@@ -1,6 +0,0 @@
package net.sf.briar.api;
public interface ExceptionHandler<E extends Exception> {
void handleException(E exception);
}

View File

@@ -1,6 +1,5 @@
package net.sf.briar.api.transport;
import net.sf.briar.api.ExceptionHandler;
import net.sf.briar.api.db.DbException;
import net.sf.briar.api.protocol.TransportId;
@@ -11,15 +10,9 @@ import net.sf.briar.api.protocol.TransportId;
public interface ConnectionRecogniser {
/**
* Asynchronously calls one of the callback's connectionAccepted(),
* connectionRejected() or handleException() methods.
* Returns the context for the given connection if the connection was
* expected, or null if the connection was not expected.
*/
void acceptConnection(TransportId t, byte[] tag, Callback c);
interface Callback extends ExceptionHandler<DbException> {
void connectionAccepted(ConnectionContext ctx);
void connectionRejected();
}
ConnectionContext acceptConnection(TransportId t, byte[] tag)
throws DbException;
}