Skip to content

Commit

Permalink
Fix on_ws_connected notification
Browse files Browse the repository at this point in the history
  • Loading branch information
taras committed Aug 15, 2024
1 parent 5df8734 commit ab03715
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
Binary file modified docs/source/_static/picows_benchmark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/echo_client_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


RPS = {
"c++ boost.beast": 38013
"c++ boost.beast(sync)": 42489
}


Expand Down Expand Up @@ -106,7 +106,7 @@ async def aiohttp_main(url: str, data: bytes, duration: int) -> None:
parser = argparse.ArgumentParser(description="Publish updates to telegram subscribers",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--url", default="ws://127.0.0.1:9001", help="Server url")
parser.add_argument("--msg-size", default="64", help="Message size")
parser.add_argument("--msg-size", default="256", help="Message size")
parser.add_argument("--level", default="INFO", help="python logger level")
parser.add_argument("--duration", default="5", help="duration of test in seconds")
parser.add_argument("--disable-uvloop", action="store_true", help="Disable uvloop")
Expand Down
7 changes: 3 additions & 4 deletions picows/picows.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ cdef class WSProtocol:
self._handshake_complete_future.set_result(None)
self._handshake_timeout_handle.cancel()
self._handshake_timeout_handle = None
self.listener.on_ws_connected(self.transport)
self._invoke_on_ws_connected()

cdef WSFrame frame = self._get_next_frame()
if frame is None:
Expand Down Expand Up @@ -929,7 +929,7 @@ cdef class WSProtocol:

assert False, "we should never reach this state"

cdef _invoke_on_ws_connected(self, WSFrame frame):
cdef _invoke_on_ws_connected(self):
try:
self.listener.on_ws_connected(self.transport)
except Exception as e:
Expand All @@ -938,7 +938,7 @@ cdef class WSProtocol:
self.transport.send_close(WSCloseCode.INTERNAL_ERROR)
self.transport.disconnect()
else:
self._logger.exception("Unhandled exception in on_ws_frame")
self._logger.exception("Unhandled exception in on_ws_connected")

cdef _invoke_on_ws_frame(self, WSFrame frame):
try:
Expand Down Expand Up @@ -1027,7 +1027,6 @@ async def ws_connect(str url: str,
ssl_shutdown_timeout=ssl_shutdown_timeout)

await ws_protocol.wait_until_handshake_complete()
ws_protocol.listener.on_ws_connected(ws_protocol.transport)

return ws_protocol.transport, ws_protocol.listener

Expand Down

0 comments on commit ab03715

Please sign in to comment.