olijeffers0n / rustplus

Rust+ API Wrapper Written in Python for the Game: Rust
https://rplus.ollieee.xyz/
MIT License
108 stars 28 forks source link

reconnect loop #9

Closed psykzz closed 2 years ago

psykzz commented 2 years ago
Error connecting to server
Traceback (most recent call last):
  File "c:\Users\PsyKzz\Documents\Development\rustpy-discord\venv\lib\site-packages\rustplus\api\remote\rustws.py", line 115, in send_message
    self.send(raw_data, binary=True)
  File "c:\Users\PsyKzz\Documents\Development\rustpy-discord\venv\lib\site-packages\ws4py\websocket.py", line 303, in send
    self._write(m)
  File "c:\Users\PsyKzz\Documents\Development\rustpy-discord\venv\lib\site-packages\ws4py\websocket.py", line 285, in _write
    self.sock.sendall(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\PsyKzz\Documents\Development\rustpy-discord\venv\lib\site-packages\rustplus\api\remote\rustws.py", line 44, in connect
    super().connect()
  File "c:\Users\PsyKzz\Documents\Development\rustpy-discord\venv\lib\site-packages\ws4py\client\__init__.py", line 218, in connect
    self.sock.connect(self.bind_addr)
OSError: [WinError 10056] A connect request was made on an already connected socket
Cannot Connect to server. Retrying in 10

This happened because the server closed the connection

Error connecting to server
Traceback (most recent call last):
    b = self.sock.recv(self.reading_buffer_size)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

It looks like the reconnect logic needs to clear the existing socket first.

olijeffers0n commented 2 years ago

Yes, I am trying to re-work the whole WebSocket Connection but I have been busy with other things. I have also seemingly run out of ideas in order to fix it. If you have any ideas feel free to join the discord server to discuss it 😄

olijeffers0n commented 2 years ago

As of now an experimental build has been posted in the discord server which appears to fix issues like this. This will be released to master if functional. Thanks for raising this specific issue.