bonifaido / rust-zookeeper

Pure Rust library for Apache ZooKeeper built on MIO
MIT License
206 stars 46 forks source link

in leader_latch ,the zookeeper can't drop after zookeeper network error #82

Open widefire opened 3 years ago

widefire commented 3 years ago

leader.rs fn start

let latch = self.clone();
// this step ,while LeaderLatch has field zk,zookeeper has ref self let subscription = self.zk.add_listener(move |x| handle_state_change(&latch, x));

leader.rs fn stop

   self.set_path(None)?;//if set_path failed, never remove_listener,so the Arc<ZooKeeper> never drop
   ......
   self.zk.remove_listener(sub);