mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
Massive refactoring to merge handling of simplex and duplex connections.
This commit is contained in:
@@ -75,8 +75,8 @@ class AliceConnector extends Connector {
|
||||
Writer w;
|
||||
byte[] secret;
|
||||
try {
|
||||
in = conn.getInputStream();
|
||||
out = conn.getOutputStream();
|
||||
in = conn.getReader().getInputStream();
|
||||
out = conn.getWriter().getOutputStream();
|
||||
r = readerFactory.createReader(in);
|
||||
w = writerFactory.createWriter(out);
|
||||
// Alice goes first
|
||||
@@ -130,7 +130,7 @@ class AliceConnector extends Connector {
|
||||
// Confirmation succeeded - upgrade to a secure connection
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info(pluginName + " confirmation succeeded");
|
||||
int maxFrameLength = conn.getMaxFrameLength();
|
||||
int maxFrameLength = conn.getReader().getMaxFrameLength();
|
||||
StreamReader streamReader =
|
||||
streamReaderFactory.createInvitationStreamReader(in,
|
||||
maxFrameLength, secret, false);
|
||||
|
||||
@@ -69,8 +69,8 @@ class BobConnector extends Connector {
|
||||
Writer w;
|
||||
byte[] secret;
|
||||
try {
|
||||
in = conn.getInputStream();
|
||||
out = conn.getOutputStream();
|
||||
in = conn.getReader().getInputStream();
|
||||
out = conn.getWriter().getOutputStream();
|
||||
r = readerFactory.createReader(in);
|
||||
w = writerFactory.createWriter(out);
|
||||
// Alice goes first
|
||||
@@ -130,7 +130,7 @@ class BobConnector extends Connector {
|
||||
// Confirmation succeeded - upgrade to a secure connection
|
||||
if(LOG.isLoggable(INFO))
|
||||
LOG.info(pluginName + " confirmation succeeded");
|
||||
int maxFrameLength = conn.getMaxFrameLength();
|
||||
int maxFrameLength = conn.getReader().getMaxFrameLength();
|
||||
StreamReader streamReader =
|
||||
streamReaderFactory.createInvitationStreamReader(in,
|
||||
maxFrameLength, secret, true);
|
||||
|
||||
@@ -311,7 +311,8 @@ abstract class Connector extends Thread {
|
||||
boolean exception) {
|
||||
try {
|
||||
LOG.info("Closing connection");
|
||||
conn.dispose(exception, true);
|
||||
conn.getReader().dispose(exception, true);
|
||||
conn.getWriter().dispose(exception);
|
||||
} catch(IOException e) {
|
||||
if(LOG.isLoggable(WARNING)) LOG.log(WARNING, e.toString(), e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user