hifi / heisenbridge

a bouncer-style Matrix IRC bridge
MIT License
244 stars 34 forks source link

(Re)connect to a number of rooms exceeding the 512 byte message size restriction #284

Open e-luks opened 6 months ago

e-luks commented 6 months ago

After sequentially joining some rooms and restarting the docker container of heisenbridge, i received the following error:

Apr 24 19:06:31 systemd[1075]: Started heisenbridge container.
Apr 24 19:06:31 heisenbridge[13599]: ded205e52d02ea0d36c4304c45af787979581206711aec0caa241c96bd5bc328
Apr 24 19:06:36 heisenbridge[13608]: Heisenbridge v0.0.0
Apr 24 19:06:36 heisenbridge[13608]: Fetching joined rooms...
Apr 24 19:06:36 heisenbridge[13608]: Bridge is in 43 rooms, initializing them...
Apr 24 19:06:39 heisenbridge[13608]: All valid rooms initialized, connecting network rooms...
Apr 24 19:06:39 heisenbridge[13608]: Init done with 2 networks connecting, bridge is now running!
Apr 24 19:06:45 heisenbridge[13608]: ERROR:root:Failed to flush IRC queue
Apr 24 19:06:45 heisenbridge[13608]: Traceback (most recent call last):
Apr 24 19:06:45 heisenbridge[13608]:   File "/opt/heisenbridge/heisenbridge/irc.py", line 202, in _run
Apr 24 19:06:45 heisenbridge[13608]:     super().send_raw(string)
Apr 24 19:06:45 heisenbridge[13608]:   File "/usr/lib/python3.10/site-packages/irc/client_aio.py", line 197, in send_raw
Apr 24 19:06:45 heisenbridge[13608]:     self.transport.write(self._prep_message(string))
Apr 24 19:06:45 heisenbridge[13608]:   File "/usr/lib/python3.10/site-packages/irc/client.py", line 658, in _prep_message
Apr 24 19:06:45 heisenbridge[13608]:     raise MessageTooLong(msg)
Apr 24 19:06:45 heisenbridge[13608]: irc.client.MessageTooLong: Messages limited to 512 bytes including CR/LF

I increased/decreased the string length of the join message by one byte, after which it was clear that the JOIN command was too long to be handled by the IRC server.

I have a first version running in #283 which enables me to join 57 channels on the libera chat network by splitting the amount of channels to join so that each join command itself succeeds.