Skip to content

Commit eda7d85

Browse files
authored
Merge pull request #115 from progaudi/fix/naming-and-code-style
Fix naming and code style.
2 parents 1ec676a + 34d38a9 commit eda7d85

File tree

5 files changed

+13
-46
lines changed

5 files changed

+13
-46
lines changed

src/progaudi.tarantool/IResponseWriter.cs renamed to src/progaudi.tarantool/IRequestWriter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
namespace ProGaudi.Tarantool.Client
55
{
6-
internal interface IResponseWriter : IDisposable
6+
internal interface IRequestWriter : IDisposable
77
{
88
void BeginWriting();
99

src/progaudi.tarantool/LogicalConnection.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class LogicalConnection : ILogicalConnection
2626

2727
private readonly IResponseReader _responseReader;
2828

29-
private readonly IResponseWriter _responseWriter;
29+
private readonly IRequestWriter _requestWriter;
3030

3131
private readonly ILog _logWriter;
3232

@@ -41,7 +41,7 @@ public LogicalConnection(ClientOptions options, RequestIdCounter requestIdCounte
4141

4242
_physicalConnection = new NetworkStreamPhysicalConnection();
4343
_responseReader = new ResponseReader(_clientOptions, _physicalConnection);
44-
_responseWriter = new ResponseWriter(_clientOptions, _physicalConnection);
44+
_requestWriter = new RequestWriter(_clientOptions, _physicalConnection);
4545
}
4646

4747
public uint PingsFailedByTimeoutCount
@@ -60,7 +60,7 @@ public void Dispose()
6060
_disposed = true;
6161

6262
_responseReader.Dispose();
63-
_responseWriter.Dispose();
63+
_requestWriter.Dispose();
6464
_physicalConnection.Dispose();
6565
}
6666

@@ -82,7 +82,7 @@ public async Task Connect()
8282
PingsFailedByTimeoutCount = 0;
8383

8484
_responseReader.BeginReading();
85-
_responseWriter.BeginWriting();
85+
_requestWriter.BeginWriting();
8686

8787
_clientOptions.LogWriter?.WriteLine("Server responses reading started.");
8888

@@ -96,7 +96,7 @@ public bool IsConnected()
9696
return false;
9797
}
9898

99-
return _responseReader.IsConnected && _responseWriter.IsConnected && _physicalConnection.IsConnected;
99+
return _responseReader.IsConnected && _requestWriter.IsConnected && _physicalConnection.IsConnected;
100100
}
101101

102102
private async Task LoginIfNotGuest(GreetingsResponse greetings)
@@ -141,7 +141,7 @@ private async Task<TResponse> SendRequestImpl<TRequest, TResponse>(TRequest requ
141141
var responseTask = _responseReader.GetResponseTask(requestId);
142142

143143
var headerBuffer = CreateAndSerializeBuffer(request, requestId, bodyBuffer, out var headerLength);
144-
await _responseWriter.Write(
144+
await _requestWriter.Write(
145145
new ArraySegment<byte>(headerBuffer, 0, Constants.PacketSizeBufferSize + (int) headerLength),
146146
new ArraySegment<byte>(bodyBuffer, 0, bodyBuffer.Length));
147147

src/progaudi.tarantool/LogicalConnectionManager.cs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public class LogicalConnectionManager : ILogicalConnection
3131

3232
private readonly int _pingCheckInterval = 1000;
3333

34-
private readonly TimeSpan? _pingTimeout = null;
34+
private readonly TimeSpan? _pingTimeout;
3535

3636
private DateTimeOffset _nextPingTime = DateTimeOffset.MinValue;
3737

@@ -44,16 +44,10 @@ public LogicalConnectionManager(ClientOptions options)
4444
_pingCheckInterval = _clientOptions.ConnectionOptions.PingCheckInterval;
4545
}
4646

47-
this._pingTimeout = this._clientOptions.ConnectionOptions.PingCheckTimeout;
47+
_pingTimeout = _clientOptions.ConnectionOptions.PingCheckTimeout;
4848
}
4949

50-
public uint PingsFailedByTimeoutCount
51-
{
52-
get
53-
{
54-
return _droppableLogicalConnection?.PingsFailedByTimeoutCount ?? 0;
55-
}
56-
}
50+
public uint PingsFailedByTimeoutCount => _droppableLogicalConnection?.PingsFailedByTimeoutCount ?? 0;
5751

5852
public void Dispose()
5953
{
@@ -135,15 +129,7 @@ private void CheckPing()
135129
}
136130
}
137131

138-
public bool IsConnected()
139-
{
140-
if (!_connected.WaitOne(_connectionTimeout))
141-
{
142-
return false;
143-
}
144-
145-
return IsConnectedInternal();
146-
}
132+
public bool IsConnected() => _connected.WaitOne(_connectionTimeout) && IsConnectedInternal();
147133

148134
private bool IsConnectedInternal()
149135
{

src/progaudi.tarantool/ResponseWriter.cs renamed to src/progaudi.tarantool/RequestWriter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace ProGaudi.Tarantool.Client
88
{
9-
internal class ResponseWriter : IResponseWriter
9+
internal class RequestWriter : IRequestWriter
1010
{
1111
private readonly ClientOptions _clientOptions;
1212
private readonly IPhysicalConnection _physicalConnection;
@@ -17,7 +17,7 @@ internal class ResponseWriter : IResponseWriter
1717
private readonly ManualResetEventSlim _newRequestsAvailable;
1818
private bool _disposed;
1919

20-
public ResponseWriter(ClientOptions clientOptions, IPhysicalConnection physicalConnection)
20+
public RequestWriter(ClientOptions clientOptions, IPhysicalConnection physicalConnection)
2121
{
2222
_clientOptions = clientOptions;
2323
_physicalConnection = physicalConnection;

src/progaudi.tarantool/Utils/AsyncLazy.cs

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)