Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/SIPSorcery/net/SCTP/Chunks/SctpTlvChunkParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ public ushort ParseFirstWord(byte[] buffer, int posn)
// The buffer was not big enough to supply the specified chunk parameter.
int bytesRequired = paramLen;
int bytesAvailable = buffer.Length - posn;
throw new ApplicationException($"The SCTP chunk parameter buffer was too short. " +
$"Required {bytesRequired} bytes but only {bytesAvailable} available.");
throw new ApplicationException($"The SCTP chunk parameter buffer was too short. Required {bytesRequired} bytes but only {bytesAvailable} available.");
}

return paramLen;
Expand Down
14 changes: 7 additions & 7 deletions src/SIPSorcery/net/SCTP/SctpAssociation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,13 +400,13 @@ internal void OnPacketReceived(SctpPacket packet)
OnAbortReceived?.Invoke(abortReason);
break;

case var ct when ct == SctpChunkType.COOKIE_ACK && State != SctpAssociationState.CookieEchoed:
case var _ when chunkType == SctpChunkType.COOKIE_ACK && State != SctpAssociationState.CookieEchoed:
// https://tools.ietf.org/html/rfc4960#section-5.2.5
// At any state other than COOKIE-ECHOED, an endpoint should silently
// discard a received COOKIE ACK chunk.
break;

case var ct when ct == SctpChunkType.COOKIE_ACK && State == SctpAssociationState.CookieEchoed:
case var _ when chunkType == SctpChunkType.COOKIE_ACK && State == SctpAssociationState.CookieEchoed:
SetState(SctpAssociationState.Established);
CancelTimers();
_dataSender.StartSending();
Expand Down Expand Up @@ -468,13 +468,13 @@ internal void OnPacketReceived(SctpPacket packet)
SendChunk(chunk);
break;

case var ct when ct == SctpChunkType.INIT_ACK && State != SctpAssociationState.CookieWait:
case var _ when chunkType == SctpChunkType.INIT_ACK && State != SctpAssociationState.CookieWait:
// https://tools.ietf.org/html/rfc4960#section-5.2.3
// If an INIT ACK is received by an endpoint in any state other than the
// COOKIE - WAIT state, the endpoint should discard the INIT ACK chunk.
break;

case var ct when ct == SctpChunkType.INIT_ACK && State == SctpAssociationState.CookieWait:
case var _ when chunkType == SctpChunkType.INIT_ACK && State == SctpAssociationState.CookieWait:

if (_t1Init != null)
{
Expand Down Expand Up @@ -528,23 +528,23 @@ internal void OnPacketReceived(SctpPacket packet)
}
break;

case var ct when ct == SctpChunkType.INIT_ACK && State != SctpAssociationState.CookieWait:
case var _ when chunkType == SctpChunkType.INIT_ACK && State != SctpAssociationState.CookieWait:
logger.LogWarning("SCTP association received INIT_ACK chunk in wrong state of {State}, ignoring.", State);
break;

case SctpChunkType.SACK:
_dataSender.GotSack(chunk as SctpSackChunk);
break;

case var ct when ct == SctpChunkType.SHUTDOWN && State == SctpAssociationState.Established:
case var _ when chunkType == SctpChunkType.SHUTDOWN && State == SctpAssociationState.Established:
// TODO: Check outstanding data chunks.
_dataSender?.Close();
var shutdownAck = new SctpChunk(SctpChunkType.SHUTDOWN_ACK);
SendChunk(shutdownAck);
SetState(SctpAssociationState.ShutdownAckSent);
break;

case var ct when ct == SctpChunkType.SHUTDOWN_ACK && State == SctpAssociationState.ShutdownSent:
case var _ when chunkType == SctpChunkType.SHUTDOWN_ACK && State == SctpAssociationState.ShutdownSent:
SetState(SctpAssociationState.Closed);
var shutCompleteChunk = new SctpChunk(SctpChunkType.SHUTDOWN_COMPLETE,
(byte)(_remoteVerificationTag != 0 ? SHUTDOWN_CHUNK_TBIT_FLAG : 0x00));
Expand Down
Loading