[optimize] merge network write
This commit is contained in:
9
.idea/.idea.Abyss/.idea/workspace.xml
generated
9
.idea/.idea.Abyss/.idea/workspace.xml
generated
@@ -9,12 +9,7 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="bf317275-3039-49bb-a475-725a800a0cce" name="Changes" comment="">
|
<list default="true" id="bf317275-3039-49bb-a475-725a800a0cce" name="Changes" comment="" />
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.Abyss/.idea/workspace.xml" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Abyss/Components/Services/AbyssService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Services/AbyssService.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Abyss/Components/Services/UserService.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Services/UserService.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Abyss/Components/Tools/AbyssStream.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Abyss/Components/Tools/AbyssStream.cs" afterDir="false" />
|
|
||||||
</list>
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||||
@@ -208,7 +203,7 @@
|
|||||||
<workItem from="1757735249561" duration="5523000" />
|
<workItem from="1757735249561" duration="5523000" />
|
||||||
<workItem from="1757742881713" duration="2285000" />
|
<workItem from="1757742881713" duration="2285000" />
|
||||||
<workItem from="1757745929389" duration="93000" />
|
<workItem from="1757745929389" duration="93000" />
|
||||||
<workItem from="1757751423586" duration="2362000" />
|
<workItem from="1757751423586" duration="2687000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -419,18 +419,21 @@ namespace Abyss.Components.Tools
|
|||||||
}
|
}
|
||||||
|
|
||||||
var payloadLen = unchecked((uint)(ciphertext.Length + tag.Length));
|
var payloadLen = unchecked((uint)(ciphertext.Length + tag.Length));
|
||||||
var header = new byte[4];
|
|
||||||
BinaryPrimitives.WriteUInt32BigEndian(header, payloadLen);
|
|
||||||
|
|
||||||
await base.WriteAsync(header, 0, header.Length, cancellationToken).ConfigureAwait(false);
|
var packet = new byte[4 + payloadLen];
|
||||||
|
BinaryPrimitives.WriteUInt32BigEndian(packet.AsSpan(0, 4), payloadLen);
|
||||||
|
|
||||||
if (ciphertext.Length > 0)
|
if (ciphertext.Length > 0)
|
||||||
await base.WriteAsync(ciphertext, 0, ciphertext.Length, cancellationToken).ConfigureAwait(false);
|
ciphertext.CopyTo(packet.AsSpan(4));
|
||||||
await base.WriteAsync(tag, 0, tag.Length, cancellationToken).ConfigureAwait(false);
|
tag.CopyTo(packet.AsSpan(4 + ciphertext.Length));
|
||||||
|
|
||||||
|
await base.WriteAsync(packet, 0, packet.Length, cancellationToken).ConfigureAwait(false);
|
||||||
await base.FlushAsync(cancellationToken).ConfigureAwait(false);
|
await base.FlushAsync(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
Array.Clear(nonce, 0, nonce.Length);
|
Array.Clear(nonce, 0, nonce.Length);
|
||||||
Array.Clear(tag, 0, tag.Length);
|
Array.Clear(tag, 0, tag.Length);
|
||||||
Array.Clear(ciphertext, 0, ciphertext.Length);
|
Array.Clear(ciphertext, 0, ciphertext.Length);
|
||||||
|
Array.Clear(packet, 0, packet.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
|
|||||||
Reference in New Issue
Block a user