Add rendezvous poller.

This commit is contained in:
akwizgran
2019-05-23 12:37:34 +01:00
parent 7fd8ad65be
commit a38113e862
7 changed files with 393 additions and 1 deletions

View File

@@ -52,8 +52,10 @@ public interface DuplexPlugin extends Plugin {
/**
* Creates and returns an endpoint that uses the given key material to
* rendezvous with a pending contact, and the given connection handler to
* handle incoming connections.
* handle incoming connections. Returns null if an endpoint cannot be
* created.
*/
@Nullable
RendezvousEndpoint createRendezvousEndpoint(KeyMaterialSource k,
ConnectionHandler incoming);
}

View File

@@ -1,6 +1,7 @@
package org.briarproject.bramble.api.rendezvous;
import static java.util.concurrent.TimeUnit.DAYS;
import static java.util.concurrent.TimeUnit.MINUTES;
public interface RendezvousConstants {
@@ -14,6 +15,11 @@ public interface RendezvousConstants {
*/
long RENDEZVOUS_TIMEOUT_MS = DAYS.toMillis(2);
/**
* How often to try to rendezvous with pending contacts.
*/
long POLLING_INTERVAL_MS = MINUTES.toMillis(1);
/**
* Label for deriving the rendezvous key from the handshake key pairs.
*/

View File

@@ -0,0 +1,25 @@
package org.briarproject.bramble.api.rendezvous.event;
import org.briarproject.bramble.api.contact.PendingContactId;
import org.briarproject.bramble.api.event.Event;
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
import javax.annotation.concurrent.Immutable;
/**
* An event that is broadcast when a rendezvous with a pending contact fails.
*/
@Immutable
@NotNullByDefault
public class RendezvousFailedEvent extends Event {
private final PendingContactId pendingContactId;
public RendezvousFailedEvent(PendingContactId pendingContactId) {
this.pendingContactId = pendingContactId;
}
public PendingContactId getPendingContactId() {
return pendingContactId;
}
}