Skip to content

Commit

Permalink
packer/rpc: clean up unnecessary functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellh committed Dec 12, 2013
1 parent b93a9c0 commit b1f07dc
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions packer/rpc/muxconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b1f07dc

Please sign in to comment.