You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// If the request sending was offloaded to be done concurrently and not awaited withing SendAsync (by calling connection.LogException),
136
+
// the _sendBuffer disposal is the responsibility of that offloaded task to prevent returning buffer to the pool while it still might be accessed by the task.
137
+
if(!_concurrentWrite)
138
+
{
139
+
_sendBuffer.Dispose();
140
+
}
141
+
// If the response receiving was offloaded to be done concurrently and not awaited withing SendAsync (by calling connection.LogException),
142
+
// the _recvBuffer disposal is the responsibility of that offloaded task to prevent returning buffer to the pool while it still might be accessed by the task.
143
+
if(!_concurrentRead)
144
+
{
145
+
_recvBuffer.Dispose();
146
+
}
135
147
}
136
148
137
149
publicvoidGoAway()
@@ -199,6 +211,7 @@ await Task.WhenAny(sendRequestTask, readResponseTask).ConfigureAwait(false) == s
199
211
// Exceptions will be bubbled up from sendRequestTask here,
200
212
// which means the result of readResponseTask won't be observed directly:
201
213
// Do a background await to log any exceptions.
214
+
_concurrentRead=true;
202
215
_connection.LogExceptions(readResponseTask);
203
216
throw;
204
217
}
@@ -207,6 +220,7 @@ await Task.WhenAny(sendRequestTask, readResponseTask).ConfigureAwait(false) == s
207
220
{
208
221
// Duplex is being used, so we can't wait for content to finish sending.
209
222
// Do a background await to log any exceptions.
223
+
_concurrentWrite=true;
210
224
_connection.LogExceptions(sendRequestTask);
211
225
}
212
226
@@ -226,12 +240,6 @@ await Task.WhenAny(sendRequestTask, readResponseTask).ConfigureAwait(false) == s
226
240
{
227
241
// The server doesn't need the whole request to respond so it's aborting its reading side gracefully, see https://datatracker.ietf.org/doc/html/rfc9114#section-4.1-15.
228
242
}
229
-
catch(OperationCanceledException)
230
-
{
231
-
// If the request got cancelled before WritesClosed completed, avoid leaking an unobserved task exception.
0 commit comments