Closed g-mark closed 1 year ago
Fixes an EventSource.start() re-entrancy problem
EventSource.start()
When:
Then:
URLSession
URLRequest
URLSessionDataTask
The underlying issue is that start() is checking for readyState == .raw, but readyState isn't set until a network response has been received.
start()
readyState
.raw
Requirements
Related issues
None
Describe the solution you've provided
Set readyState = .connecting in start(), immediately after checking for readyState == .raw.
readyState = .connecting
readyState == .raw
Describe alternatives you've considered
Additional context
Hi there @g-mark , thank you for the contribution! I have it on my list to take a look at the changes and related code/behavior and if it looks good, we'll integrate the change.
Fixes an
EventSource.start()
re-entrancy problemWhen:
EventSource.start()
is calledEventSource.start()
is called again, before the network response from the first call has been receivedThen:
URLSession
andURLRequest
are created, and a newURLSessionDataTask
is startedThe underlying issue is that
start()
is checking forreadyState
==.raw
, butreadyState
isn't set until a network response has been received.Requirements
Related issues
None
Describe the solution you've provided
Set
readyState = .connecting
instart()
, immediately after checking forreadyState == .raw
.Describe alternatives you've considered
None
Additional context
None