Commit 51e0714
authored
During the connection handshake:
* `WebSocketTask::is_active` erronously returns `false`.
* Dropping `WebSocketTask` drops the `WebSocket` without
calling `WebSocket::close` on it, resulting in the WebSocket
"leaking"; it will typically continue the connection
handshake and remain connected to the server, despite the
client having dropped the object representing it.
Fix these by considering the task to be active if the
WebSocket `ready_state` is *either* `WebSocket::OPEN` or
`WebSocket::CONNECTING`.
Add two tests to check that a `WebSocketTask` returns `true`
for `is_active` while it's connecting, and that dropping
the `WebSocketTask` while it's connecting results in
the underlying WebSocket being closed properly.
1 parent a1fa79d commit 51e0714
1 file changed
+51
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
248 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
249 | 252 | | |
250 | 253 | | |
251 | 254 | | |
| |||
397 | 400 | | |
398 | 401 | | |
399 | 402 | | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
400 | 450 | | |
0 commit comments