Skip to content

Commit 7cf8f27

Browse files
committed
Address review comments.
1 parent 360365a commit 7cf8f27

File tree

4 files changed

+12
-36
lines changed

4 files changed

+12
-36
lines changed

docker-compose.tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ services:
77
command: /app/scripts/test-netcore.sh
88
environment:
99
TARANTOOL_REPLICATION_SOURCE: "tarantool:3301"
10-
TEAMCITY_PROJECT_NAME: 123
1110
links:
1211
- tarantool
1312
- redis

src/progaudi.tarantool/LogicalConnection.cs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ internal class LogicalConnection : ILogicalConnection
2424

2525
private readonly IPhysicalConnection _physicalConnection;
2626

27-
private readonly ReaderWriterLockSlim _physicalConnectionLock = new ReaderWriterLockSlim();
28-
2927
private readonly IResponseReader _responseReader;
3028

3129
private readonly IResponseWriter _responseWriter;
@@ -147,27 +145,6 @@ await _responseWriter.Write(
147145
new ArraySegment<byte>(headerBuffer, 0, Constants.PacketSizeBufferSize + (int) headerLength),
148146
new ArraySegment<byte>(bodyBuffer, 0, bodyBuffer.Length));
149147

150-
//try
151-
//{
152-
// _physicalConnectionLock.EnterWriteLock();
153-
154-
// _logWriter?.WriteLine($"Begin sending request header buffer, requestId: {requestId}, code: {request.Code}, length: {headerBuffer.Length}");
155-
// _physicalConnection.Write(headerBuffer, 0, Constants.PacketSizeBufferSize + (int)headerLength);
156-
157-
// _logWriter?.WriteLine($"Begin sending request body buffer, length: {bodyBuffer.Length}");
158-
// _physicalConnection.Write(bodyBuffer, 0, bodyBuffer.Length);
159-
//}
160-
//catch
161-
//{
162-
// _logWriter?.WriteLine($"Request with requestId {requestId} failed, header:\n{ToReadableString(headerBuffer)} \n body: \n{ToReadableString(bodyBuffer)}");
163-
// Dispose();
164-
// throw;
165-
//}
166-
//finally
167-
//{
168-
// _physicalConnectionLock.ExitWriteLock();
169-
//}
170-
171148
try
172149
{
173150
if (timeout.HasValue)

src/progaudi.tarantool/ResponseReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void Dispose()
6161

6262
foreach (var response in _pendingRequests.Values)
6363
{
64-
response.SetException(new InvalidOperationException("Can't read from physical connection."));
64+
response.SetException(new ObjectDisposedException(nameof(ResponseReader)));
6565
}
6666

6767
_pendingRequests.Clear();

src/progaudi.tarantool/ResponseWriter.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@ void WriteBuffer(ArraySegment<byte> buffer)
105105
_physicalConnection.Write(buffer.Array, buffer.Offset, buffer.Count);
106106
}
107107

108+
Tuple<ArraySegment<byte>, ArraySegment<byte>> GetRequest()
109+
{
110+
lock (_lock)
111+
{
112+
if (_buffer.Count > 0)
113+
return _buffer.Dequeue();
114+
}
115+
116+
return null;
117+
}
118+
108119
Tuple<ArraySegment<byte>, ArraySegment<byte>> request;
109120
var count = 0;
110121
while ((request = GetRequest()) != null)
@@ -131,16 +142,5 @@ void WriteBuffer(ArraySegment<byte> buffer)
131142

132143
_physicalConnection.Flush();
133144
}
134-
135-
private Tuple<ArraySegment<byte>, ArraySegment<byte>> GetRequest()
136-
{
137-
lock (_lock)
138-
{
139-
if (_buffer.Count > 0)
140-
return _buffer.Dequeue();
141-
}
142-
143-
return null;
144-
}
145145
}
146146
}

0 commit comments

Comments
 (0)