Skip to content

Commit 560b645

Browse files
committed
[webwindow] remember if connection was first
Keep connection on the first place when just reconnect it.
1 parent ebae537 commit 560b645

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gui/webdisplay/inc/ROOT/RWebWindow.hxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ private:
6969
struct WebConn {
7070
unsigned fConnId{0}; ///<! connection id (unique inside the window)
7171
bool fHeadlessMode{false}; ///<! indicate if connection represent batch job
72+
bool fWasFirst{false}; ///<! indicate if this was first connection, will be reinjected also on first place
7273
std::string fKey; ///<! key value supplied to the window (when exists)
7374
int fKeyUsed{0}; ///<! key value used to verify connection
7475
std::string fNewKey; ///<! new key if connection request reload

gui/webdisplay/src/RWebWindow.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ std::shared_ptr<RWebWindow::WebConn> RWebWindow::RemoveConnection(unsigned wsid)
289289
res = std::move(fConn[n]);
290290
fConn.erase(fConn.begin() + n);
291291
res->fActive = false;
292+
res->fWasFirst = (n == 0);
292293
break;
293294
}
294295
}
@@ -766,6 +767,7 @@ bool RWebWindow::ProcessWS(THttpCallArg &arg)
766767
conn->fKey = conn->fNewKey;
767768
conn->fNewKey.clear();
768769
conn->fConnId = ++fConnCnt; // change connection id to avoid confusion
770+
conn->fWasFirst = true;
769771
conn->ResetData();
770772
conn->ResetStamps(); // reset stamps, after timeout connection wll be removed
771773
fPendingConn.emplace_back(conn);
@@ -834,7 +836,10 @@ bool RWebWindow::ProcessWS(THttpCallArg &arg)
834836
// preserve key for longpoll or when with session key used for HMAC hash of messages
835837
// conn->fKey.clear();
836838
conn->ResetStamps();
837-
fConn.emplace_back(conn);
839+
if (conn->fWasFirst)
840+
fConn.emplace(fConn.begin(), conn);
841+
else
842+
fConn.emplace_back(conn);
838843
return true;
839844
} else if (!IsRequireAuthKey() && (!fConnLimit || (fConn.size() < fConnLimit))) {
840845
fConn.emplace_back(std::make_shared<WebConn>(++fConnCnt, arg.GetWSId()));

0 commit comments

Comments
 (0)