Skip to content

Commit a50e62d

Browse files
committed
[dotnet] [bidi] Give only one chance to receive from remote end
1 parent 9a4bbcc commit a50e62d

File tree

1 file changed

+9
-7
lines changed
  • dotnet/src/webdriver/BiDi/Communication

1 file changed

+9
-7
lines changed

dotnet/src/webdriver/BiDi/Communication/Broker.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,23 @@ public async Task ConnectAsync(CancellationToken cancellationToken)
123123

124124
private async Task ReceiveMessagesAsync(CancellationToken cancellationToken)
125125
{
126-
while (!cancellationToken.IsCancellationRequested)
126+
try
127127
{
128-
try
128+
while (!cancellationToken.IsCancellationRequested)
129129
{
130130
var data = await _transport.ReceiveAsync(cancellationToken).ConfigureAwait(false);
131131

132132
ProcessReceivedMessage(data);
133133
}
134-
catch (Exception ex)
134+
}
135+
catch (Exception ex)
136+
{
137+
if (cancellationToken.IsCancellationRequested is false && _logger.IsEnabled(LogEventLevel.Error))
135138
{
136-
if (cancellationToken.IsCancellationRequested is not true && _logger.IsEnabled(LogEventLevel.Error))
137-
{
138-
_logger.Error($"Couldn't process received BiDi remote message: {ex}");
139-
}
139+
_logger.Error($"Couldn't process received BiDi remote message: {ex}");
140140
}
141+
142+
throw;
141143
}
142144
}
143145

0 commit comments

Comments
 (0)