mirror of
https://github.com/OPCFoundation/UA-.NETStandard.git
synced 2026-10-28 22:55:49 +08:00
Secure channel: seal symmetric chunks in place
SealSymmetricMessage copied the encoded chunks into a second BufferCollection. The chunks are now replaced in place by the segments to send, which are over the same buffers, so the encoded collection is the one sent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
730cec1985
commit
2135f7d7f9
@@ -939,7 +939,8 @@ namespace Opc.Ua.Bindings
|
|||||||
const int headerSize = TcpMessageLimits.SymmetricHeaderSize +
|
const int headerSize = TcpMessageLimits.SymmetricHeaderSize +
|
||||||
TcpMessageLimits.SequenceHeaderSize;
|
TcpMessageLimits.SequenceHeaderSize;
|
||||||
|
|
||||||
var chunksToSend = new BufferCollection(chunksToProcess.Count);
|
// the chunks are secured in place: each body segment is replaced by the
|
||||||
|
// segment to send, which covers the headers in the same buffer.
|
||||||
int lastChunk = chunksToProcess.Count - 1;
|
int lastChunk = chunksToProcess.Count - 1;
|
||||||
|
|
||||||
for (int ii = 0; ii < chunksToProcess.Count; ii++)
|
for (int ii = 0; ii < chunksToProcess.Count; ii++)
|
||||||
@@ -1028,13 +1029,12 @@ namespace Opc.Ua.Bindings
|
|||||||
position);
|
position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the header into chunk.
|
chunksToProcess[ii] = dataToSend;
|
||||||
chunksToSend.Add(dataToSend);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensure the buffers don't get cleaned up on exit.
|
// ensure the buffers don't get cleaned up on exit.
|
||||||
success = true;
|
success = true;
|
||||||
return chunksToSend;
|
return chunksToProcess;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user