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
Idea : zk::connection should provide a way to reconnect after a connection is loss,
as well as an atomic state
Considering the following example :
zk::connection con = zk::connection::connection("zk://addr:port/?opts");
// somewhere else ...switch (con->state())
{ // handle some connection loss casescase zk::state::closed: [[fallthrough]];
case zk::state::expired_session:
{
reset_connection(); // smthg like `con = zk::connection::connection("zk://addr:port/?opts");`break;
}
default:
break;
}
In the sample above, the issue is the switch/case is error-prone, as erasing con content may result in invalid con->state() read in a concurrent context.
This force the user to create some blocking operation using memory barriers and perhaps condition_variales,
to ensure no wrong states are evaluated during connection reset.
The text was updated successfully, but these errors were encountered:
Idea :
zk::connection
should provide a way toreconnect
after a connection is loss,as well as an atomic state
Considering the following example :
In the sample above, the issue is the switch/case is error-prone, as erasing
con
content may result in invalidcon->state()
read in a concurrent context.This force the user to create some blocking operation using memory barriers and perhaps condition_variales,
to ensure no wrong states are evaluated during connection reset.
The text was updated successfully, but these errors were encountered: