[tor-commits] [stem/master] Revert "Add temporary scripts for testing async communication with sockets"

atagar at torproject.org atagar at torproject.org
Thu Jul 16 01:28:58 UTC 2020


commit e6974dd5bbb804a6b98d172c2eb55206f6a47a56
Author: Illia Volochii <illia.volochii at gmail.com>
Date:   Sat Mar 14 22:05:15 2020 +0200

    Revert "Add temporary scripts for testing async communication with sockets"
    
    This reverts commit 072b5e682faa6d190fa8cd4cc52651fdc10b3e01.
---
 test_control_port.py        | 30 ------------------------------
 test_control_socket_file.py | 30 ------------------------------
 test_relay_socket.py        | 28 ----------------------------
 3 files changed, 88 deletions(-)

diff --git a/test_control_port.py b/test_control_port.py
deleted file mode 100644
index 85fe26d4..00000000
--- a/test_control_port.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import asyncio
-
-from stem.async_socket import ControlPort
-
-
-async def run_command(i, command):
-  async with ControlPort() as cp:
-    print(f'{i} Connecting')
-    await cp.connect()
-    print(f'{i} Authenticating')
-    await cp.send('AUTHENTICATE "password"')
-    print(f'{i} Receiving auth message')
-    await cp.recv()
-    print(f'{i} Sending the command')
-    await cp.send(command)
-    print(f'{i} Receiving result of the command')
-    result = await cp.recv()
-    print(f'{i} {result.content()}')
-
-
-if __name__ == '__main__':
-  loop = asyncio.get_event_loop()
-  tasks = asyncio.gather(
-    run_command(1, 'PROTOCOLINFO 1'),
-    run_command(2, 'GETINFO traffic/read'),
-  )
-  try:
-    loop.run_until_complete(tasks)
-  finally:
-    loop.close()
diff --git a/test_control_socket_file.py b/test_control_socket_file.py
deleted file mode 100644
index 4c6816f4..00000000
--- a/test_control_socket_file.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import asyncio
-
-from stem.async_socket import ControlSocketFile
-
-
-async def run_command(i, command):
-  async with ControlSocketFile() as cp:
-    print(f'{i} Connecting')
-    await cp.connect()
-    print(f'{i} Authenticating')
-    await cp.send('AUTHENTICATE "password"')
-    print(f'{i} Receiving auth message')
-    await cp.recv()
-    print(f'{i} Sending the command')
-    await cp.send(command)
-    print(f'{i} Receiving result of the command')
-    result = await cp.recv()
-    print(f'{i} {result.content()}')
-
-
-if __name__ == '__main__':
-  loop = asyncio.get_event_loop()
-  tasks = asyncio.gather(
-    run_command(1, 'PROTOCOLINFO 1'),
-    run_command(2, 'GETINFO traffic/read'),
-  )
-  try:
-    loop.run_until_complete(tasks)
-  finally:
-    loop.close()
diff --git a/test_relay_socket.py b/test_relay_socket.py
deleted file mode 100644
index 76289d46..00000000
--- a/test_relay_socket.py
+++ /dev/null
@@ -1,28 +0,0 @@
-import asyncio
-
-from stem.client import DEFAULT_LINK_PROTOCOLS
-from stem.client.cell import VersionsCell
-from stem.async_socket import RelaySocket
-
-
-async def run_command(i, command):
-  async with RelaySocket(address='127.0.0.1', port=443) as cp:
-    print(f'{i} Connecting')
-    await cp.connect()
-    print(f'{i} Sending the command')
-    await cp.send(command)
-    print(f'{i} Receiving result of the command')
-    result = await cp.recv(2)
-    print(result)
-
-
-if __name__ == '__main__':
-  loop = asyncio.get_event_loop()
-  tasks = asyncio.gather(
-    run_command(1, VersionsCell(DEFAULT_LINK_PROTOCOLS).pack(2)),
-    run_command(2, VersionsCell(DEFAULT_LINK_PROTOCOLS).pack(2)),
-  )
-  try:
-    loop.run_until_complete(tasks)
-  finally:
-    loop.close()





More information about the tor-commits mailing list