Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
yutakahirano committed Sep 24, 2021
1 parent 92d8d96 commit d814385
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/webtransport/h3/webtransport_h3_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def close(self, close_info: Optional[Tuple[int, bytes]]) -> None:
:param close_info The close information to send.
"""
if self._handler:
self._handler.disallow_calling_session_closed()
assert self._session_stream_id is not None
if close_info is not None:
code = close_info.code
Expand Down Expand Up @@ -310,7 +312,7 @@ def __init__(self, session: WebTransportSession,
callbacks: Dict[str, Any]) -> None:
self._session = session
self._callbacks = callbacks
self._called_session_closed = False
self._allow_calling_session_closed = True

def _run_callback(self, callback_name: str,
*args: Any, **kwargs: Any) -> None:
Expand Down Expand Up @@ -340,12 +342,14 @@ def datagram_received(self, data: bytes) -> None:

def session_closed(
self, close_info: Optional[Tuple[int, bytes]], abruptly: bool):
if _called_session_closed:
if not self._allow_calling_session_closed:
return
_called_session_closed = True
self._allow_calling_session_closed = False
self._run_callback(
"session_closed", self._session, close_info, abruptly=abruptly)

def disallow_calling_session_closed(self):
self._allow_calling_session_closed = False

class SessionTicketStore:
"""
Expand Down
1 change: 1 addition & 0 deletions webtransport/connect.any.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// META: global=window,worker
// META: script=/common/get-host-info.sub.js
// META: script=resources/webtransport-test-helpers.sub.js
// META: script=/common/utils.js

promise_test(async t => {
const wt = new WebTransport(webtransport_url('custom-response.py?:status=200'));
Expand Down

0 comments on commit d814385

Please sign in to comment.