Skip to content

Commit

Permalink
properly handle error case
Browse files Browse the repository at this point in the history
  • Loading branch information
DarienRaymond committed Apr 5, 2018
1 parent 61a1cce commit 2b67533
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/proxyman/mux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,11 @@ func (m *Client) handleStatusKeep(meta *FrameMetadata, reader *buf.BufferedReade
}

if s, found := m.sessionManager.Get(meta.SessionID); found {
return buf.Copy(s.NewReader(reader), s.output, buf.IgnoreWriterError())
if err := buf.Copy(s.NewReader(reader), s.output); err != nil {
drain(reader)
s.input.CloseError()
return s.Close()
}
}
return drain(reader)
}
Expand Down Expand Up @@ -359,7 +363,11 @@ func (w *ServerWorker) handleStatusKeep(meta *FrameMetadata, reader *buf.Buffere
return nil
}
if s, found := w.sessionManager.Get(meta.SessionID); found {
return buf.Copy(s.NewReader(reader), s.output, buf.IgnoreWriterError())
if err := buf.Copy(s.NewReader(reader), s.output); err != nil {
drain(reader)
s.input.CloseError()
return s.Close()
}
}
return drain(reader)
}
Expand Down

0 comments on commit 2b67533

Please sign in to comment.