|
20 | 20 | import logging |
21 | 21 | import socket |
22 | 22 | import struct |
| 23 | +import warnings |
23 | 24 |
|
24 | 25 | from .transport.TTransport import TTransportException, TTransportBase, TMemoryBuffer |
25 | 26 |
|
@@ -66,17 +67,27 @@ def _lock_context(self): |
66 | 67 | class TTornadoStreamTransport(TTransportBase): |
67 | 68 | """a framed, buffered transport over a Tornado stream""" |
68 | 69 | def __init__(self, host, port, stream=None, io_loop=None): |
| 70 | + if io_loop is not None: |
| 71 | + warnings.warn( |
| 72 | + "The `io_loop` parameter is deprecated and unused. Passing " |
| 73 | + "`io_loop` is unnecessary because Tornado now automatically " |
| 74 | + "provides the current I/O loop via `IOLoop.current()`. " |
| 75 | + "Remove the `io_loop` parameter to ensure compatibility - it " |
| 76 | + "will be removed in a future release.", |
| 77 | + DeprecationWarning, |
| 78 | + stacklevel=2, |
| 79 | + ) |
69 | 80 | self.host = host |
70 | 81 | self.port = port |
71 | | - self.io_loop = io_loop or ioloop.IOLoop.current() |
| 82 | + self.io_loop = ioloop.IOLoop.current() |
72 | 83 | self.__wbuf = BytesIO() |
73 | 84 | self._read_lock = _Lock() |
74 | 85 |
|
75 | 86 | # servers provide a ready-to-go stream |
76 | 87 | self.stream = stream |
77 | 88 |
|
78 | 89 | def with_timeout(self, timeout, future): |
79 | | - return gen.with_timeout(timeout, future, self.io_loop) |
| 90 | + return gen.with_timeout(timeout, future) |
80 | 91 |
|
81 | 92 | @gen.coroutine |
82 | 93 | def open(self, timeout=None): |
@@ -164,8 +175,7 @@ def __init__(self, processor, iprot_factory, oprot_factory=None, |
164 | 175 | @gen.coroutine |
165 | 176 | def handle_stream(self, stream, address): |
166 | 177 | host, port = address[:2] |
167 | | - trans = TTornadoStreamTransport(host=host, port=port, stream=stream, |
168 | | - io_loop=self.io_loop) |
| 178 | + trans = TTornadoStreamTransport(host=host, port=port, stream=stream) |
169 | 179 | oprot = self._oprot_factory.getProtocol(trans) |
170 | 180 |
|
171 | 181 | try: |
|
0 commit comments