mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 03:09:04 +01:00
Add rendezvous poller.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user