From b1f07dcbe098c34ca133f17914645ce96735fb0f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 12 Dec 2013 13:21:42 -0800 Subject: [PATCH] packer/rpc: clean up unnecessary functions --- packer/rpc/muxconn.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packer/rpc/muxconn.go b/packer/rpc/muxconn.go index f0e0ace39..46f2f43ea 100644 --- a/packer/rpc/muxconn.go +++ b/packer/rpc/muxconn.go @@ -418,14 +418,6 @@ func (s *Stream) remoteClose() { s.writeCh <- nil } -func (s *Stream) registerStateListener(ch chan<- streamState) { - s.stateChange[ch] = struct{}{} -} - -func (s *Stream) deregisterStateListener(ch chan<- streamState) { - delete(s.stateChange, ch) -} - func (s *Stream) setState(state streamState) { log.Printf("[TRACE] Stream %d went to state %d", s.id, state) s.state = state @@ -441,12 +433,12 @@ func (s *Stream) setState(state streamState) { func (s *Stream) waitState(target streamState) error { // Register a state change listener to wait for changes stateCh := make(chan streamState, 10) - s.registerStateListener(stateCh) + s.stateChange[stateCh] = struct{}{} s.mu.Unlock() defer func() { s.mu.Lock() - s.deregisterStateListener(stateCh) + delete(s.stateChange, stateCh) }() state := <-stateCh