Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var lw = function(type, state, p){
if( type == ZooKeeper.ZOO_CHANGED_EVENT ) {
zk.aw_get( path, lw, function() {} );
} else if( type == ZooKeeper.ZOO_DELETED_EVENT ) {
// Our sentinal disappeared - this could mean that
// we are now the leader, or it could mean that we
// need to watch someone else.
zk_election(zk,dir,me,cb);
} else if( type == ZooKeeper.ZOO_SESSION_EVENT ) {
//console.log("Session problem!");
// zk will keep our callback around - no need to re-establish.
} else {
console.log( "Unkown type: " + type );
throw new Error("Unknown change type");
}
};
zk.aw_get( path, lw, function() {} );
var lw = function(type, state, p){
if( type == ZooKeeper.ZOO_CHANGED_EVENT ) {
zk.aw_get( path, lw, function() {} );
} else if( type == ZooKeeper.ZOO_DELETED_EVENT ) {
// Our sentinal disappeared - this could mean that
// we are now the leader, or it could mean that we
// need to watch someone else.
election(zk,dir,me);
} else if( type == ZooKeeper.ZOO_SESSION_EVENT ) {
//console.log("Session problem!");
// zk will keep our callback around - no need to re-establish.
} else {
console.log( "Unkown type: " + type );
//zk.aw_get( path, lw, function() {} );
}
};
zk.aw_get( path, lw, function() {} );