mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Allow the transport to specify the maximum segment length.
This commit is contained in:
@@ -14,12 +14,12 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
|
||||
|
||||
private final OutgoingErrorCorrectionLayer out;
|
||||
private final Mac mac;
|
||||
private final int maxFrameLength;
|
||||
|
||||
OutgoingAuthenticationLayerImpl(OutgoingErrorCorrectionLayer out, Mac mac,
|
||||
ErasableKey macKey) {
|
||||
this.out = out;
|
||||
this.mac = mac;
|
||||
// Initialise the MAC
|
||||
try {
|
||||
mac.init(macKey);
|
||||
} catch(InvalidKeyException badKey) {
|
||||
@@ -28,6 +28,7 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
|
||||
macKey.erase();
|
||||
if(mac.getMacLength() != MAC_LENGTH)
|
||||
throw new IllegalArgumentException();
|
||||
maxFrameLength = out.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public void writeFrame(Frame f) throws IOException {
|
||||
@@ -49,4 +50,8 @@ class OutgoingAuthenticationLayerImpl implements OutgoingAuthenticationLayer {
|
||||
public long getRemainingCapacity() {
|
||||
return out.getRemainingCapacity();
|
||||
}
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user