Unverified Commit 42917447 authored by Eric_Lee's avatar Eric_Lee Committed by GitHub

Merge pull request #154 from jumpserver/dev_bugfix

[bugfix] fix lock bugs
parents 226a91fa cc53d77e
...@@ -66,9 +66,6 @@ func (w *WrapperSession) Close() error { ...@@ -66,9 +66,6 @@ func (w *WrapperSession) Close() error {
return nil return nil
default: default:
} }
w.mux.Lock()
defer w.mux.Unlock()
_ = w.outReader.Close()
err := w.inWriter.Close() err := w.inWriter.Close()
w.initReadPip() w.initReadPip()
return err return err
...@@ -79,6 +76,8 @@ func (w *WrapperSession) Write(p []byte) (int, error) { ...@@ -79,6 +76,8 @@ func (w *WrapperSession) Write(p []byte) (int, error) {
} }
func (w *WrapperSession) initReadPip() { func (w *WrapperSession) initReadPip() {
w.mux.Lock()
defer w.mux.Unlock()
w.outReader, w.inWriter = io.Pipe() w.outReader, w.inWriter = io.Pipe()
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment