readthedocs-fr / aioircd Goto Github PK
View Code? Open in Web Editor NEWA minimalist asynchronous IRC server
License: MIT License
A minimalist asynchronous IRC server
License: MIT License
It would be nice to document the application using tools like sphinx and to host it somewhere. We could host there tutorials, UML diagrams and whatever would be nice to ease the talk. Any ideas ?
You can re-join the same channel multiple times, it should be forbidden.
Steps to reproduce:
Tracekback:
[IO] recv from DrLazor: b'JOIN #second-salon'
[DEBUG] Dispatch to JOIN: ('#second-salon',)
[IO] send to #second-salon: :DrLazor JOIN #second-salon
[IO] send to DrLazor: :DrLazor JOIN #second-salon
[IO] send to matterbot: :DrLazor JOIN #second-salon
[IO] recv from matterbot: b'WHO DrLazor %tacuhnr,1'
[DEBUG] Dispatch to WHO: ('DrLazor', '%tacuhnr,1')
[WARNING] Command WHO sent by matterbot failed, code: 400
[IO] send to matterbot: :drlazor.be 400 matterbot - :Command WHO is unknown.
[ERROR] Error while serving matterbot.
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/aioircd/user.py", line 144, in serve
await self.state.dispatch(*args)
File "/usr/local/lib/python3.9/dist-packages/aioircd/states.py", line 42, in dispatch
raise ErrUnknownError(self.user, '-', f"Command {cmd} is unknown.")
aioircd.exceptions.ErrUnknownError: :drlazor.be 400 matterbot - :Command WHO is unknown.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/aioircd/server.py", line 28, in handle
await user.serve()
File "/usr/local/lib/python3.9/dist-packages/aioircd/user.py", line 148, in serve
await self.send(exc.args[0])
File "/usr/local/lib/python3.9/dist-packages/aioircd/user.py", line 172, in send
await self.stream.send_all(b"".join(f"{msg}\r\n".encode() for msg in messages))
File "/usr/local/lib/python3.9/dist-packages/trio/_highlevel_socket.py", line 99, in send_all
with self._send_conflict_detector:
File "/usr/local/lib/python3.9/dist-packages/trio/_util.py", line 190, in __enter__
raise trio.BusyResourceError(self._msg)
trio.BusyResourceError: another task is currently sending data on this SocketStream
[INFO] Terminate connection of matterbot
[IO] send to #général: :matterbot QUIT :[':Internal', 'host', 'error']
[IO] send to #second-salon: :matterbot QUIT :[':Internal', 'host', 'error']
[IO] send to DrLazor: :drlazor.be 353 DrLazor = #second-salon :DrLazor
[IO] send to DrLazor: :matterbot QUIT :[':Internal', 'host', 'error']
[IO] send to DrLazor: :drlazor.be 366 DrLazor #second-salon :End of /NAMES list.
[CRITICAL] Dead
Traceback (most recent call last):
File "/usr/local/lib/python3.9/dist-packages/aioircd/__main__.py", line 43, in main
trio.run(server.serve)
File "/usr/local/lib/python3.9/dist-packages/trio/_core/_run.py", line 1932, in run
raise runner.main_task_outcome.error
File "/usr/local/lib/python3.9/dist-packages/aioircd/server.py", line 52, in serve
await trio.serve_tcp(self.handle, self.port, host=self.addr)
File "/usr/local/lib/python3.9/dist-packages/trio/_highlevel_open_tcp_listeners.py", line 219, in serve_tcp
await trio.serve_listeners(
File "/usr/local/lib/python3.9/dist-packages/trio/_highlevel_serve_listeners.py", line 121, in serve_listeners
task_status.started(listeners)
File "/usr/local/lib/python3.9/dist-packages/trio/_core/_run.py", line 815, in __aexit__
raise combined_error_from_nursery
File "/usr/local/lib/python3.9/dist-packages/trio/_highlevel_serve_listeners.py", line 25, in _run_handler
await handler(stream)
File "/usr/local/lib/python3.9/dist-packages/aioircd/server.py", line 34, in handle
await user.terminate("Internal host error")
File "/usr/local/lib/python3.9/dist-packages/aioircd/user.py", line 158, in terminate
await self.state.QUIT(f":{kick_msg}".split(' '), kick=True)
File "/usr/local/lib/python3.9/dist-packages/aioircd/states.py", line 104, in QUIT
await chan.send(f":{self.user.nick} QUIT :{reason}")
File "/usr/local/lib/python3.9/dist-packages/aioircd/channel.py", line 35, in send
self._nursery.start_soon(partial(
File "/usr/local/lib/python3.9/dist-packages/trio/_core/_run.py", line 815, in __aexit__
raise combined_error_from_nursery
File "/usr/local/lib/python3.9/dist-packages/aioircd/user.py", line 172, in send
await self.stream.send_all(b"".join(f"{msg}\r\n".encode() for msg in messages))
File "/usr/local/lib/python3.9/dist-packages/trio/_highlevel_socket.py", line 99, in send_all
with self._send_conflict_detector:
File "/usr/local/lib/python3.9/dist-packages/trio/_util.py", line 190, in __enter__
raise trio.BusyResourceError(self._msg)
trio.BusyResourceError: another task is currently sending data on this SocketStream
I think it would be nice to add some unittests to the project.
What would be great is to fake the network layer by sending fake reader
and writer
objects to the Server.handler
method. We could simulate a few users and validate various flow.
We should start by testing the happy flow, a valid usage of the application.
I don't know if unittests would fit in the current single-file architecture of the project. Your ideas ?
julien@drlazor ~> python3 -m aioircd
Traceback (most recent call last):
File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.7/dist-packages/aioircd.py", line 15, in <module>
with open(f'{ROOT}/VERSION') as fd:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.7/dist-packages/VERSION'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.