mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-30 20:28:08 +00:00
Fix StreamWriter doesn't have the wait_closed() method in Python3.6. Fixes #2170
This commit is contained in:
parent
3c2ae5363c
commit
a7d19fd89a
@ -408,6 +408,7 @@ class BaseNode:
|
|||||||
|
|
||||||
if self._wrapper_telnet_server:
|
if self._wrapper_telnet_server:
|
||||||
self._wrap_console_writer.close()
|
self._wrap_console_writer.close()
|
||||||
|
if sys.version_info >= (3, 7, 0):
|
||||||
await self._wrap_console_writer.wait_closed()
|
await self._wrap_console_writer.wait_closed()
|
||||||
self._wrapper_telnet_server.close()
|
self._wrapper_telnet_server.close()
|
||||||
await self._wrapper_telnet_server.wait_closed()
|
await self._wrapper_telnet_server.wait_closed()
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
import sys
|
||||||
import socket
|
import socket
|
||||||
import asyncio
|
import asyncio
|
||||||
import asyncio.subprocess
|
import asyncio.subprocess
|
||||||
@ -202,6 +203,7 @@ class AsyncioTelnetServer:
|
|||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
async with self._lock:
|
async with self._lock:
|
||||||
network_writer.close()
|
network_writer.close()
|
||||||
|
if sys.version_info >= (3, 7, 0):
|
||||||
await network_writer.wait_closed()
|
await network_writer.wait_closed()
|
||||||
if self._reader_process == network_reader:
|
if self._reader_process == network_reader:
|
||||||
self._reader_process = None
|
self._reader_process = None
|
||||||
@ -218,6 +220,7 @@ class AsyncioTelnetServer:
|
|||||||
writer.write_eof()
|
writer.write_eof()
|
||||||
await writer.drain()
|
await writer.drain()
|
||||||
writer.close()
|
writer.close()
|
||||||
|
if sys.version_info >= (3, 7, 0):
|
||||||
await writer.wait_closed()
|
await writer.wait_closed()
|
||||||
except (AttributeError, ConnectionError):
|
except (AttributeError, ConnectionError):
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user