File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4040 lastServer = ""
4141)
4242
43+ func main () {
44+ flag .Parse ()
45+ connectZK (* server )
46+
47+ zkCmds := flag .Args ()
48+ if zkCmds == nil || len (zkCmds ) == 0 {
49+ loop ()
50+ } else {
51+ // one time command line
52+ err := execZkCmd (zkconn .con , zkCmds [0 ], zkCmds [1 :])
53+ if err != nil {
54+ fmt .Println (err )
55+ os .Exit (1 )
56+ } else {
57+ os .Exit (0 )
58+ }
59+ }
60+ }
61+
4362func connectZK (address string ) {
4463 if zkconn .con != nil && zkconn .con .State () == zk .StateHasSession {
4564 //close existed connection first
@@ -83,25 +102,6 @@ func connectZK(address string) {
83102 }
84103}
85104
86- func main () {
87- flag .Parse ()
88- connectZK (* server )
89-
90- zkCmds := flag .Args ()
91- if zkCmds == nil || len (zkCmds ) == 0 {
92- loop ()
93- } else {
94- // one time command line
95- err := execZkCmd (zkconn .con , zkCmds [0 ], zkCmds [1 :])
96- if err != nil {
97- fmt .Println (err )
98- os .Exit (1 )
99- } else {
100- os .Exit (0 )
101- }
102- }
103- }
104-
105105func isConnected (con * zk.Conn ) bool {
106106 return con .State () == zk .StateHasSession
107107}
You can’t perform that action at this time.
0 commit comments