Skip to content

Commit

Permalink
Removed use of logger from connection state base and related connecti…
Browse files Browse the repository at this point in the history
…ng states
  • Loading branch information
sacOO7 committed Aug 10, 2023
1 parent c0b7d05 commit 3e072d8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ internal class ConnectionClosedState : ConnectionStateBase
{
public override ErrorInfo DefaultErrorInfo => ErrorInfo.ReasonClosed;

public ConnectionClosedState(IConnectionContext context, ILogger logger)
: this(context, null, logger)
public ConnectionClosedState(IConnectionContext context)
: this(context, null)
{
}

public ConnectionClosedState(IConnectionContext context, ErrorInfo error, ILogger logger)
: base(context, logger)
public ConnectionClosedState(IConnectionContext context, ErrorInfo error)
: base(context)
{
Error = error ?? ErrorInfo.ReasonClosed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ internal class ConnectionClosingState : ConnectionStateBase
private readonly ICountdownTimer _timer;

public ConnectionClosingState(IConnectionContext context, bool connectedTransport, ILogger logger)
: this(context, null, connectedTransport, new CountdownTimer("Closing state timer", logger), logger)
: this(context, null, connectedTransport, new CountdownTimer("Closing state timer", logger))
{
}

public ConnectionClosingState(IConnectionContext context, ErrorInfo error, bool connectedTransport, ICountdownTimer timer, ILogger logger)
: base(context, logger)
public ConnectionClosingState(IConnectionContext context, ErrorInfo error, bool connectedTransport, ICountdownTimer timer)
: base(context)
{
_connectedTransport = connectedTransport;
_timer = timer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ namespace IO.Ably.Transport.States.Connection
{
internal class ConnectionConnectedState : ConnectionStateBase
{
public ConnectionConnectedState(
IConnectionContext context,
public ConnectionConnectedState(IConnectionContext context,
ErrorInfo error = null,
bool isUpdate = false,
ILogger logger = null)
: base(context, logger)
bool isUpdate = false)
: base(context)
{
Error = error;
IsUpdate = isUpdate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ internal class ConnectionConnectingState : ConnectionStateBase
private readonly ICountdownTimer _timer;

public ConnectionConnectingState(IConnectionContext context, ILogger logger)
: this(context, new CountdownTimer("Connecting state timer", logger), logger)
: this(context, new CountdownTimer("Connecting state timer", logger))
{
}

public ConnectionConnectingState(IConnectionContext context, ICountdownTimer timer, ILogger logger)
: base(context, logger)
public ConnectionConnectingState(IConnectionContext context, ICountdownTimer timer)
: base(context)
{
_timer = timer;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ internal class ConnectionDisconnectedState : ConnectionStateBase
private readonly ICountdownTimer _timer;

public ConnectionDisconnectedState(IConnectionContext context, ErrorInfo error, ILogger logger)
: this(context, error, new CountdownTimer("Disconnected state timer", logger), logger)
: this(context, error, new CountdownTimer("Disconnected state timer", logger))
{
}

public ConnectionDisconnectedState(IConnectionContext context, ErrorInfo error, ICountdownTimer timer, ILogger logger)
: base(context, logger)
public ConnectionDisconnectedState(IConnectionContext context, ErrorInfo error, ICountdownTimer timer)
: base(context)
{
_timer = timer;
Error = error;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ internal class ConnectionFailedState : ConnectionStateBase
{
public override ErrorInfo DefaultErrorInfo => ErrorInfo.ReasonFailed;

public ConnectionFailedState(IConnectionContext context, ErrorInfo error, ILogger logger)
: base(context, logger)
public ConnectionFailedState(IConnectionContext context, ErrorInfo error) : base(context)
{
Error = error ?? ErrorInfo.ReasonFailed;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace IO.Ably.Transport.States.Connection
{
internal class ConnectionInitializedState : ConnectionStateBase
{
public ConnectionInitializedState(IConnectionContext context, ILogger logger)
: base(context, logger)
public ConnectionInitializedState(IConnectionContext context)
: base(context)
{ }

public override bool CanQueue => true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ namespace IO.Ably.Transport.States.Connection
[DebuggerDisplay("{State}")]
internal abstract class ConnectionStateBase
{
protected ConnectionStateBase(IConnectionContext context, ILogger logger)
protected ConnectionStateBase(IConnectionContext context)
{
Logger = logger ?? DefaultLogger.LoggerInstance;
Context = context;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ internal class ConnectionSuspendedState : ConnectionStateBase
public override ErrorInfo DefaultErrorInfo => ErrorInfo.ReasonSuspended;

public ConnectionSuspendedState(IConnectionContext context, ILogger logger)
: this(context, null, new CountdownTimer("Suspended state timer", logger), logger)
: this(context, null, new CountdownTimer("Suspended state timer", logger))
{
}

public ConnectionSuspendedState(IConnectionContext context, ErrorInfo error, ILogger logger)
: this(context, error, new CountdownTimer("Suspended state timer", logger), logger)
: this(context, error, new CountdownTimer("Suspended state timer", logger))
{
}

public ConnectionSuspendedState(IConnectionContext context, ErrorInfo error, ICountdownTimer timer, ILogger logger)
: base(context, logger)
public ConnectionSuspendedState(IConnectionContext context, ErrorInfo error, ICountdownTimer timer)
: base(context)
{
_timer = timer;
Error = error ?? ErrorInfo.ReasonSuspended;
Expand Down

0 comments on commit 3e072d8

Please sign in to comment.