Compare commits
No commits in common. "ca49fb303758deadaf65d6d187e7da8fdb96dd72" and "a381805c3c6b8f11296345a180c7ee83a0b32e76" have entirely different histories.
ca49fb3037
...
a381805c3c
@ -13,6 +13,6 @@ __author__ = "Davide Testa"
|
|||||||
__email__ = "davide@davte.it"
|
__email__ = "davide@davte.it"
|
||||||
__credits__ = []
|
__credits__ = []
|
||||||
__license__ = "GNU General Public License v3.0"
|
__license__ = "GNU General Public License v3.0"
|
||||||
__version__ = "0.0.10"
|
__version__ = "0.0.8"
|
||||||
__maintainer__ = "Davide Testa"
|
__maintainer__ = "Davide Testa"
|
||||||
__contact__ = "t.me/davte"
|
__contact__ = "t.me/davte"
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
mode = input("Do you want to run a filebridging (S)erver or (C)lient?\t\t")
|
|
||||||
if mode.lower().startswith('s'):
|
|
||||||
from .server import main
|
|
||||||
else:
|
|
||||||
from .client import main
|
|
||||||
main()
|
|
@ -436,6 +436,7 @@ class Client:
|
|||||||
force=(new_progress == 100)
|
force=(new_progress == 100)
|
||||||
)
|
)
|
||||||
if not input_data:
|
if not input_data:
|
||||||
|
continue
|
||||||
break
|
break
|
||||||
file_to_receive.write(input_data)
|
file_to_receive.write(input_data)
|
||||||
print() # New line after sys.stdout.write
|
print() # New line after sys.stdout.write
|
||||||
|
@ -73,7 +73,7 @@ class Server:
|
|||||||
def set_ssl_context(self, ssl_context: ssl.SSLContext):
|
def set_ssl_context(self, ssl_context: ssl.SSLContext):
|
||||||
self._ssl_context = ssl_context
|
self._ssl_context = ssl_context
|
||||||
|
|
||||||
async def run_reader(self, reader: asyncio.StreamReader, connection_token):
|
async def run_reader(self, reader, connection_token):
|
||||||
while 1:
|
while 1:
|
||||||
try:
|
try:
|
||||||
# Wait one second if buffer is full
|
# Wait one second if buffer is full
|
||||||
@ -82,6 +82,7 @@ class Server:
|
|||||||
continue
|
continue
|
||||||
input_data = await reader.read(self.buffer_chunk_size)
|
input_data = await reader.read(self.buffer_chunk_size)
|
||||||
if connection_token not in self.buffers:
|
if connection_token not in self.buffers:
|
||||||
|
print("Here!")
|
||||||
break
|
break
|
||||||
self.buffers[connection_token].append(input_data)
|
self.buffers[connection_token].append(input_data)
|
||||||
except ConnectionResetError as e:
|
except ConnectionResetError as e:
|
||||||
@ -90,7 +91,7 @@ class Server:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Unexpected exception:\n{e}", exc_info=True)
|
logging.error(f"Unexpected exception:\n{e}", exc_info=True)
|
||||||
|
|
||||||
async def run_writer(self, writer: asyncio.StreamWriter, connection_token):
|
async def run_writer(self, writer, connection_token):
|
||||||
consecutive_interruptions = 0
|
consecutive_interruptions = 0
|
||||||
errors = 0
|
errors = 0
|
||||||
while connection_token in self.buffers:
|
while connection_token in self.buffers:
|
||||||
@ -100,7 +101,6 @@ class Server:
|
|||||||
# Slow down if buffer is empty; after 1.5 s of silence, break
|
# Slow down if buffer is empty; after 1.5 s of silence, break
|
||||||
consecutive_interruptions += 1
|
consecutive_interruptions += 1
|
||||||
if consecutive_interruptions > 3:
|
if consecutive_interruptions > 3:
|
||||||
logging.error("Too many interruptions...")
|
|
||||||
break
|
break
|
||||||
await asyncio.sleep(.5)
|
await asyncio.sleep(.5)
|
||||||
continue
|
continue
|
||||||
@ -167,7 +167,6 @@ class Server:
|
|||||||
else:
|
else:
|
||||||
return 0 # On success, return 0
|
return 0 # On success, return 0
|
||||||
# On exception, disconnect and return 1
|
# On exception, disconnect and return 1
|
||||||
logging.error("Disconnecting...")
|
|
||||||
self.disconnect(connection_token=connection_token)
|
self.disconnect(connection_token=connection_token)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user