You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 🤔
The text was updated successfully, but these errors were encountered:
Hi @marc-legendre , thanks for reporting the issue. I somewhat understand what the issue is, but I can't think of how to fix it off the top of my head. I'll try to take a look at this during the weekend, in the meantime if you want to raise a PR for the fix please feel free to do so!
Are you certain it's a bug?
Are you sure this is not an issue in noVNC?
Is there an existing issue for this?
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()
oncerfb
is in adisconnected
state.This happens when losing the connection to the server. Indeed, a call to
connect()
is scheduled without clearingrfb
orconnected
. Then whenconnect()
is called, it callsdisconnect()
, which callsrfb.disconnect()
.Note: noVNC emits an error, but handles the situation gracefully.
Clearing
rfb
prevents this from happening:Intuitively, I'd also clear
connected
. But I am not entirely sure if I getconnected
right, since it is initialized totrue
when autoconnect is enabled. I find this puzzling 🤔The text was updated successfully, but these errors were encountered: