Skip to content

Commit 29e81e2

Browse files
authored
Removed object pipe (#779)
1 parent 634f13d commit 29e81e2

File tree

12 files changed

+197
-581
lines changed

12 files changed

+197
-581
lines changed

src/SuperSocket.Client/EasyClient.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public abstract class EasyClient : IEasyClient
3737

3838
internal static readonly int DefaultSocketSenderPoolSize = 10;
3939

40+
private bool _continuousReceivingStarted = false;
41+
4042
protected EasyClient()
4143
: this(NullLogger.Instance)
4244
{
@@ -222,7 +224,9 @@ private void StartReceive()
222224
client.OnError("The receive task was cancelled.");
223225
return;
224226
}
225-
}, this, TaskContinuationOptions.OnlyOnFaulted);;
227+
}, this, TaskContinuationOptions.OnlyOnFaulted);
228+
229+
_continuousReceivingStarted = true;
226230
}
227231

228232
protected abstract Task StartReceiveAsync();
@@ -280,7 +284,17 @@ protected virtual async ValueTask SendAsync<TSendPackage>(IPackageEncoder<TSendP
280284

281285
public virtual async ValueTask CloseAsync()
282286
{
283-
await Connection.CloseAsync(CloseReason.LocalClosing);
287+
var closeTask = Connection.CloseAsync(CloseReason.LocalClosing);
288+
289+
if (_continuousReceivingStarted)
290+
{
291+
await closeTask;
292+
}
293+
else
294+
{
295+
await Task.WhenAll(closeTask.AsTask(), StartReceiveAsync());
296+
}
297+
284298
OnClosed(this, EventArgs.Empty);
285299
}
286300
}

src/SuperSocket.Connection/DefaultObjectPipe.cs

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

src/SuperSocket.Connection/IObjectPipe.cs

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

0 commit comments

Comments
 (0)