Skip to content

Commit

Permalink
Fix build.
Browse files Browse the repository at this point in the history
  • Loading branch information
HarryCordewener committed Jan 4, 2024
1 parent a2d30cf commit 6c177ec
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion TelnetNegotiationCore.TestServer/KestrelMockServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace TelnetNegotiationCore.TestServer
{
public class KestrelMockServer : ConnectionHandler
{
private ILogger _Logger;
private readonly ILogger _Logger;

public KestrelMockServer(ILogger logger = null): base()
{
Expand Down
2 changes: 0 additions & 2 deletions TelnetNegotiationCore/Interpreters/TelnetMSDPInterpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ namespace TelnetNegotiationCore.Interpreters
/// </remarks>
public partial class TelnetInterpreter
{
private Func<dynamic> _MSDPConfig;

private List<byte> _currentMSDPInfo;

public Func<MSDPConfig, Task> SignalOnMSDPAsync { get; init; }
Expand Down
30 changes: 15 additions & 15 deletions TelnetNegotiationCore/Interpreters/TelnetMSSPInterpreter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public partial class TelnetInterpreter
private Func<MSSPConfig> _msspConfig = () => new();

private List<byte> _currentMSSPVariable;
private List<List<byte>> _currentMSSPValueList;
private List<byte> _currentMSSPValue;
private List<List<byte>> _currentMSSPVariableList;
private List<List<byte>> _currentMSSPValueList;

public Func<MSSPConfig, Task> SignalOnMSSPAsync { get; init; }

Expand Down Expand Up @@ -73,10 +73,10 @@ private StateMachine<State, Trigger> SetupMSSPNegotiation(StateMachine<State, Tr
.Permit(Trigger.MSSP, State.AlmostNegotiatingMSSP)
.OnEntry(() =>
{
_currentMSDPValue = [];
_currentMSDPInfo = [];
_currentMSDPValueList = [];
_currentMSDPVariableList = [];
_currentMSSPValue = [];
_currentMSSPVariable = [];
_currentMSSPValueList = [];
_currentMSSPVariableList = [];
});

tsm.Configure(State.AlmostNegotiatingMSSP)
Expand Down Expand Up @@ -117,27 +117,27 @@ private StateMachine<State, Trigger> SetupMSSPNegotiation(StateMachine<State, Tr

private void RegisterMSSPVal()
{
if (!_currentMSDPValue.Any()) return;
if (_currentMSSPValue.Count == 0) return;

_currentMSDPValueList.Add(_currentMSDPValue);
_currentMSDPValue = new List<byte>();
_currentMSSPValueList.Add(_currentMSSPValue);
_currentMSSPValue = [];
}

private void RegisterMSSPVar()
{
if (!_currentMSDPInfo.Any()) return;
if (_currentMSSPVariable.Count == 0) return;

_currentMSDPVariableList.Add(_currentMSDPInfo);
_currentMSDPInfo = new List<byte>();
_currentMSSPVariableList.Add(_currentMSSPVariable);
_currentMSSPVariable = [];
}

private async Task ReadMSSPValues()
{
RegisterMSSPVal();
RegisterMSSPVar();

var grouping = _currentMSDPVariableList
.Zip(_currentMSDPValueList)
var grouping = _currentMSSPVariableList
.Zip(_currentMSSPValueList)
.GroupBy(x => CurrentEncoding.GetString(x.First.ToArray()));

foreach (var group in grouping)
Expand Down Expand Up @@ -205,14 +205,14 @@ private void CaptureMSSPVariable(OneOf<byte, Trigger> b)
{
// We could increment here based on having switched... Somehow?
// We need a better state tracking for this, to indicate the transition.
_currentMSDPInfo.Add(b.AsT0);
_currentMSSPVariable.Add(b.AsT0);
}

private void CaptureMSSPValue(OneOf<byte, Trigger> b)
{
// We could increment here based on having switched... Somehow?
// We need a better state tracking for this, to indicate the transition.
_currentMSDPValue.Add(b.AsT0);
_currentMSSPValue.Add(b.AsT0);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial class TelnetInterpreter
/// <summary>
/// A list of terminal types for this connection.
/// </summary>
public ImmutableList<string> TerminalTypes { get; private set; } = ImmutableList<string>.Empty;
public ImmutableList<string> TerminalTypes { get; private set; } = [];

/// <summary>
/// The current selected Terminal Type. Use RequestTerminalTypeAsync if you want the client to switch to the next mode.
Expand Down

0 comments on commit 6c177ec

Please sign in to comment.