@@ -756,21 +756,24 @@ bool RWebWindow::ProcessWS(THttpCallArg &arg)
756756
757757 std::lock_guard<std::mutex> grd (fConnMutex );
758758
759- if (is_longpoll && !is_remote && ntry == " 1" s && ( fConn . size () > 0 ) && ! fConn [ 0 ]-> fNewKey . empty () ) {
760- // special workaround for local displays
761- // they are not disconnected regularly when reload page
759+ if (is_longpoll && !is_remote && ntry == " 1" s) {
760+ // special workaround for local displays like qt5/qt6
761+ // they are not disconnected regularly when page reload is invoked
762762 // therefore try to detect if new key is applied
763- if (key == HMAC (fConn [0 ]->fNewKey , " " s, " attempt_1" , 9 )) {
764- auto conn = std::move (fConn [0 ]);
765- fConn .erase (fConn .begin ());
766- conn->fKeyUsed = 0 ;
767- conn->fKey = conn->fNewKey ;
768- conn->fNewKey .clear ();
769- conn->fConnId = ++fConnCnt ; // change connection id to avoid confusion
770- conn->fWasFirst = true ;
771- conn->ResetData ();
772- conn->ResetStamps (); // reset stamps, after timeout connection wll be removed
773- fPendingConn .emplace_back (conn);
763+ for (unsigned indx = 0 ; indx < fConn .size (); indx++) {
764+ if (!fConn [indx]->fNewKey .empty () && (key == HMAC (fConn [indx]->fNewKey , " " s, " attempt_1" , 9 ))) {
765+ auto conn = std::move (fConn [indx]);
766+ fConn .erase (fConn .begin () + indx);
767+ conn->fKeyUsed = 0 ;
768+ conn->fKey = conn->fNewKey ;
769+ conn->fNewKey .clear ();
770+ conn->fConnId = ++fConnCnt ; // change connection id to avoid confusion
771+ conn->fWasFirst = indx == 0 ;
772+ conn->ResetData ();
773+ conn->ResetStamps (); // reset stamps, after timeout connection wll be removed
774+ fPendingConn .emplace_back (conn);
775+ break ;
776+ }
774777 }
775778 }
776779
0 commit comments