Closed XertroV closed 10 years ago
Is there a kind of bugfix implemented? I've noticed that if you bind a port number already in use, anything warns you (the chat program keeps with all the input logic, but you will never receive any external input).
If you do Ctrl + C, you can get a message like this:
^CFuture/Task exception was never retrieved:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/asyncio/base_events.py", line 554, in create_server
sock.bind(sa)
OSError: [Errno 98] Address already in use
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.3/dist-packages/asyncio/tasks.py", line 281, in _step
result = coro.send(value)
File "/usr/local/lib/python3.3/dist-packages/spore/__init__.py", line 200, in _create_server
self._server = yield from self._loop.create_server(self._protocol_factory, *self._address)
File "/usr/local/lib/python3.3/dist-packages/asyncio/base_events.py", line 558, in create_server
% (sa, err.strerror.lower()))
OSError: [Errno 98] error while attempting to bind on address ('127.0.0.1', 5000): address already in use
Traceback (most recent call last):
File "./test_encryption.py", line 71, in <module>
message = input(nick.rjust(10).decode() + ": ").encode()
KeyboardInterrupt
It is, to pass all exceptions, currently a good practice? You don't get even an alert in stdout or stderr, and makes the code harder to debug.
I've removed the catch-all try: except as per devnix's recommendation. If a user wants to wrap their own code in a catch-all try except, they can.
When the spore.broadcast() method has an exception it crashes the parent thread - not good.
Suggest spore.broadcast() forks off into it's own thread, or returns True/False based on success or not, but catches any exceptions.