|
28 | 28 | from tornado.concurrent import Future, future_set_result_unless_cancelled |
29 | 29 | from tornado.escape import utf8, native_str, to_unicode |
30 | 30 | from tornado import gen, httpclient, httputil |
31 | | -from tornado.ioloop import IOLoop, PeriodicCallback |
| 31 | +from tornado.ioloop import IOLoop |
32 | 32 | from tornado.iostream import StreamClosedError, IOStream |
33 | 33 | from tornado.log import gen_log, app_log |
34 | 34 | from tornado.netutil import Resolver |
@@ -860,7 +860,6 @@ def __init__( |
860 | 860 | # the effect of compression, frame overhead, and control frames. |
861 | 861 | self._wire_bytes_in = 0 |
862 | 862 | self._wire_bytes_out = 0 |
863 | | - self.ping_callback = None # type: Optional[PeriodicCallback] |
864 | 863 | self._received_pong = False # type: bool |
865 | 864 | self.close_code = None # type: Optional[int] |
866 | 865 | self.close_reason = None # type: Optional[str] |
@@ -1327,13 +1326,13 @@ def ping_timeout(self) -> float: |
1327 | 1326 | # Note: using de_dupe_gen_log to prevent this message from |
1328 | 1327 | # being duplicated for each connection |
1329 | 1328 | logging.WARNING, |
1330 | | - f'The websocket_ping_timeout ({timeout}) cannot be longer' |
1331 | | - f' than the websocket_ping_interval ({self.ping_interval}).' |
1332 | | - f'\nSetting websocket_ping_timeout={self.ping_interval}' |
| 1329 | + f"The websocket_ping_timeout ({timeout}) cannot be longer" |
| 1330 | + f" than the websocket_ping_interval ({self.ping_interval})." |
| 1331 | + f"\nSetting websocket_ping_timeout={self.ping_interval}", |
1333 | 1332 | ) |
1334 | 1333 | return self.ping_interval |
1335 | 1334 | return timeout |
1336 | | - return min(self.ping_interval, 30) |
| 1335 | + return self.ping_interval |
1337 | 1336 |
|
1338 | 1337 | def start_pinging(self) -> None: |
1339 | 1338 | """Start sending periodic pings to keep the connection alive""" |
@@ -1366,7 +1365,7 @@ async def periodic_ping(self) -> None: |
1366 | 1365 |
|
1367 | 1366 | # make sure we received a pong within the timeout |
1368 | 1367 | if timeout > 0 and not self._received_pong: |
1369 | | - self.close(reason='ping timed out') |
| 1368 | + self.close(reason="ping timed out") |
1370 | 1369 | return |
1371 | 1370 |
|
1372 | 1371 | # wait until the next scheduled ping |
|
0 commit comments