Commit b1f07dcb authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

packer/rpc: clean up unnecessary functions

parent b93a9c0a
...@@ -418,14 +418,6 @@ func (s *Stream) remoteClose() { ...@@ -418,14 +418,6 @@ func (s *Stream) remoteClose() {
s.writeCh <- nil 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) { func (s *Stream) setState(state streamState) {
log.Printf("[TRACE] Stream %d went to state %d", s.id, state) log.Printf("[TRACE] Stream %d went to state %d", s.id, state)
s.state = state s.state = state
...@@ -441,12 +433,12 @@ func (s *Stream) setState(state streamState) { ...@@ -441,12 +433,12 @@ func (s *Stream) setState(state streamState) {
func (s *Stream) waitState(target streamState) error { func (s *Stream) waitState(target streamState) error {
// Register a state change listener to wait for changes // Register a state change listener to wait for changes
stateCh := make(chan streamState, 10) stateCh := make(chan streamState, 10)
s.registerStateListener(stateCh) s.stateChange[stateCh] = struct{}{}
s.mu.Unlock() s.mu.Unlock()
defer func() { defer func() {
s.mu.Lock() s.mu.Lock()
s.deregisterStateListener(stateCh) delete(s.stateChange, stateCh)
}() }()
state := <-stateCh state := <-stateCh
......
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