Compare commits
62 Commits
main
...
a381805c3c
Author | SHA1 | Date | |
---|---|---|---|
a381805c3c | |||
1f200b30ab | |||
60761ebc5e | |||
b4e6be4bfa | |||
557363d3de | |||
7311ef3e72 | |||
22a20b98fc | |||
f21a7fdfb9 | |||
2ff847b44b | |||
90df61d3a6 | |||
e40989e304 | |||
4ba5065271 | |||
e77d4b4146 | |||
d703054c58 | |||
3f5384f9e9 | |||
3b7aa265ab | |||
932760bcb6 | |||
5f0ed1295f | |||
4c56ff7723 | |||
be6f8bbafc | |||
0877a08713 | |||
31ab51ec52 | |||
e203e35f8e | |||
bf57baad45 | |||
4fc9ebc38a | |||
a95d0aaa91 | |||
ae41102d4c | |||
2aead918bf | |||
4a05b05ace | |||
8bd0ac76f2 | |||
b77de07d6e | |||
4f01831169 | |||
e68ab4282c | |||
c0dd046670 | |||
f1d54861ee | |||
4352f2908b | |||
5f1c8fdf47 | |||
0069f9e5ea | |||
685b4e6756 | |||
f7a9f76aad | |||
db0da8b24b | |||
1ec3a4b5e2 | |||
ca3aa5857b | |||
1853d85a79 | |||
40f48e3b95 | |||
458cc0f5e7 | |||
25750736f4 | |||
d2522b3e08 | |||
d4abc1f2a5 | |||
9dba9673a3 | |||
018bea5606 | |||
7549977fc9 | |||
248d4ccb88 | |||
69c06dc4dc | |||
c8409e12ef | |||
70f2cd64d7 | |||
bc287833cc | |||
cab7527c63 | |||
40dba845fd | |||
971927a798 | |||
add5b42a3b | |||
a932184757 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
# Data folder
|
# Data folder
|
||||||
data/
|
data/
|
||||||
data
|
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
@@ -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
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user