Skip to content

Commit

Permalink
Renamed ClientRetryOptions to NetClientRetryOptions and moved it to a…
Browse files Browse the repository at this point in the history
… unique file
  • Loading branch information
carlst99 committed Apr 18, 2018
1 parent 0ebd7b4 commit edab07f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 27 deletions.
4 changes: 2 additions & 2 deletions src/Ether.Network/Client/NetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void Connect()

if (!IsConnected)
{
if (this.Configuration.RetryMode == ClientRetryOptions.Limited)
if (this.Configuration.RetryMode == NetClientRetryOptions.Limited)
{
int count = 0;

Expand All @@ -97,7 +97,7 @@ public void Connect()
count++;
}
}
else if (this.Configuration.RetryMode == ClientRetryOptions.Infinite)
else if (this.Configuration.RetryMode == NetClientRetryOptions.Infinite)
{
while (!IsConnected)
{
Expand Down
29 changes: 4 additions & 25 deletions src/Ether.Network/Client/NetClientConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,6 @@

namespace Ether.Network.Client
{
/// <summary>
/// Options defining how a client will handle a failed connection attempt
/// </summary>
public enum ClientRetryOptions
{
/// <summary>
/// The client will only try to connect one time
/// </summary>
OneTime = 0,

/// <summary>
/// The client will try to connect a specific amount of times
/// </summary>
Limited = 1,

/// <summary>
/// The client will try infinitely to connect to the server
/// </summary>
Infinite = 2
}

/// <summary>
/// Provides properties to configure a <see cref="NetClient"/>.
/// </summary>
Expand All @@ -35,7 +14,7 @@ public sealed class NetClientConfiguration
private int _bufferSize;
private string _host;
private int _timeOut;
private ClientRetryOptions _retryMode;
private NetClientRetryOptions _retryMode;
private int _maxRetryAttempts;

/// <summary>
Expand Down Expand Up @@ -76,9 +55,9 @@ public int TimeOut

/// <summary>
/// Gets or sets how the client handles failed connections.
/// When using <see cref="ClientRetryOptions.Limited"/> set <see cref="MaxRetryAttempts"/>
/// When using <see cref="NetClientRetryOptions.Limited"/> set <see cref="MaxRetryAttempts"/>
/// </summary>
public ClientRetryOptions RetryMode
public NetClientRetryOptions RetryMode
{
get => this._retryMode;
set => this.SetValue(ref this._retryMode, value);
Expand Down Expand Up @@ -109,7 +88,7 @@ internal NetClientConfiguration(INetClient client)
this._port = 0;
this._host = null;
this._timeOut = 5000;
this.RetryMode = ClientRetryOptions.OneTime;
this.RetryMode = NetClientRetryOptions.OneTime;
}

/// <summary>
Expand Down
27 changes: 27 additions & 0 deletions src/Ether.Network/Client/NetClientRetryOptions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Text;

namespace Ether.Network.Client
{
/// <summary>
/// Options defining how a <see cref="NetClient"/> will handle a failed connection attempt
/// </summary>
public enum NetClientRetryOptions
{
/// <summary>
/// The client will only try to connect one time
/// </summary>
OneTime = 0,

/// <summary>
/// The client will try to connect a specific amount of times
/// </summary>
Limited = 1,

/// <summary>
/// The client will try infinitely to connect to the server
/// </summary>
Infinite = 2
}
}

0 comments on commit edab07f

Please sign in to comment.