-
-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Are you certain it's a bug?
- Yes, it looks like a bug
Are you sure this is not an issue in noVNC?
- It is not a noVNC issue
Is there an existing issue for this?
- I have searched existing issues, it hasn't been reported yet
Issue description
Hi there, I'm trying out this nice little project, and I noticed a small issue.
noVNC emits an error "Tried changing state of a disconnected RFB object" when VncScreen automatically tries to reconnect after a connection loss.
Details
It is an error to call rfb.disconnect() once rfb is in a disconnected state.
This happens when losing the connection to the server. Indeed, a call to connect() is scheduled without clearing rfb or connected. Then when connect() is called, it calls disconnect(), which calls rfb.disconnect().
Note: noVNC emits an error, but handles the situation gracefully.
Clearing rfb prevents this from happening:
diff --git i/src/lib/VncScreen.tsx w/src/lib/VncScreen.tsx
index af032d9..e73d3c9 100644
--- i/src/lib/VncScreen.tsx
+++ w/src/lib/VncScreen.tsx
@@ -160,6 +160,7 @@ const VncScreen: React.ForwardRefRenderFunction<VncScreenHandle, Props> = (props
if (connected) {
logger.info(`Unexpectedly disconnected from remote VNC, retrying in ${retryDuration / 1000} seconds.`);
+ setRfb(null);
timeouts.current.push(setTimeout(connect, retryDuration));
} else {
logger.info(`Disconnected from remote VNC.`);Intuitively, I'd also clear connected. But I am not entirely sure if I get connected right, since it is initialized to true when autoconnect is enabled. I find this puzzling 🤔