Accept connections asynchronously.

This commit is contained in:
akwizgran
2011-11-17 18:59:34 +00:00
parent 27a3f6e497
commit 2b45cf0dd1
10 changed files with 273 additions and 106 deletions

View File

@@ -10,9 +10,18 @@ import net.sf.briar.api.protocol.TransportId;
public interface ConnectionRecogniser {
/**
* Returns the connection's context if the connection should be accepted,
* or null if the connection should be rejected.
* Asynchronously calls one of the callback's connectionAccepted(),
* connectionRejected() or handleException() methods.
*/
ConnectionContext acceptConnection(TransportId t, byte[] encryptedIv)
throws DbException;
void acceptConnection(TransportId t, byte[] encryptedIv,
Callback c);
interface Callback {
void connectionAccepted(ConnectionContext ctx);
void connectionRejected();
void handleException(DbException e);
}
}