mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Use separate methods for registering incoming and outgoing connections.
This commit is contained in:
@@ -61,7 +61,25 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerConnection(ContactId c, TransportId t,
|
||||
public void registerIncomingConnection(ContactId c, TransportId t,
|
||||
InterruptibleConnection conn) {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
LOG.info("Incoming connection registered: " + t);
|
||||
}
|
||||
registerConnection(c, t, conn, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOutgoingConnection(ContactId c, TransportId t,
|
||||
InterruptibleConnection conn, Priority priority) {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
LOG.info("Outgoing connection registered: " + t);
|
||||
}
|
||||
registerConnection(c, t, conn, false);
|
||||
setPriority(c, t, conn, priority);
|
||||
}
|
||||
|
||||
private void registerConnection(ContactId c, TransportId t,
|
||||
InterruptibleConnection conn, boolean incoming) {
|
||||
if (LOG.isLoggable(INFO)) {
|
||||
if (incoming) LOG.info("Incoming connection registered: " + t);
|
||||
|
||||
@@ -59,8 +59,8 @@ class IncomingDuplexSyncConnection extends DuplexSyncConnection
|
||||
onReadError(true);
|
||||
return;
|
||||
}
|
||||
connectionRegistry.registerConnection(contactId, transportId,
|
||||
this, true);
|
||||
connectionRegistry.registerIncomingConnection(contactId, transportId,
|
||||
this);
|
||||
// Start the outgoing session on another thread
|
||||
ioExecutor.execute(() -> runOutgoingSession(contactId));
|
||||
try {
|
||||
|
||||
@@ -104,9 +104,8 @@ class OutgoingDuplexSyncConnection extends DuplexSyncConnection
|
||||
onReadError();
|
||||
return;
|
||||
}
|
||||
connectionRegistry.registerConnection(contactId, transportId,
|
||||
this, false);
|
||||
connectionRegistry.setPriority(contactId, transportId, this, priority);
|
||||
connectionRegistry.registerOutgoingConnection(contactId, transportId,
|
||||
this, priority);
|
||||
try {
|
||||
// Store any transport properties discovered from the connection
|
||||
transportPropertyManager.addRemotePropertiesFromConnection(
|
||||
|
||||
Reference in New Issue
Block a user