1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-06-08 03:59:11 -04:00

fix lint errors

This commit is contained in:
Darien Raymond
2018-05-26 16:32:55 +02:00
parent b453190e58
commit fde877e276
3 changed files with 12 additions and 9 deletions

View File

@@ -133,8 +133,8 @@ func (m *Client) monitor() {
select {
case <-m.done.Wait():
m.sessionManager.Close()
common.Close(m.link.Writer)
pipe.CloseError(m.link.Reader)
common.Close(m.link.Writer) // nolint: errcheck
pipe.CloseError(m.link.Reader) // nolint: errcheck
return
case <-timer.C:
size := m.sessionManager.Size()
@@ -167,14 +167,15 @@ func fetchInput(ctx context.Context, s *Session, output buf.Writer) {
}
s.transferType = transferType
writer := NewWriter(s.ID, dest, output, transferType)
defer s.Close()
defer writer.Close()
defer s.Close() // nolint: errcheck
defer writer.Close() // nolint: errcheck
newError("dispatching request to ", dest).WithContext(ctx).WriteToLog()
if pReader, ok := s.input.(*pipe.Reader); ok {
if err := copyFirstPayload(pReader, writer); err != nil {
newError("failed to fetch first payload").Base(err).WithContext(ctx).WriteToLog()
writer.hasError = true
pipe.CloseError(s.input)
return
}
}
@@ -182,6 +183,7 @@ func fetchInput(ctx context.Context, s *Session, output buf.Writer) {
if err := buf.Copy(s.input, writer); err != nil {
newError("failed to fetch all input").Base(err).WithContext(ctx).WriteToLog()
writer.hasError = true
pipe.CloseError(s.input)
return
}
}

View File

@@ -118,8 +118,8 @@ func (m *SessionManager) Close() error {
m.closed = true
for _, s := range m.sessions {
common.Close(s.input)
common.Close(s.output)
common.Close(s.input) // nolint: errcheck
common.Close(s.output) // nolint: errcheck
}
m.sessions = nil
@@ -137,8 +137,8 @@ type Session struct {
// Close closes all resources associated with this session.
func (s *Session) Close() error {
common.Close(s.output)
common.Close(s.input)
common.Close(s.output) // nolint: errcheck
common.Close(s.input) // nolint: errcheck
s.parent.Remove(s.ID)
return nil
}

View File

@@ -102,6 +102,7 @@ func (w *Writer) WriteMultiBuffer(mb buf.MultiBuffer) error {
return nil
}
// Close implements common.Closable.
func (w *Writer) Close() error {
meta := FrameMetadata{
SessionID: w.id,
@@ -114,6 +115,6 @@ func (w *Writer) Close() error {
frame := buf.New()
common.Must(meta.WriteTo(frame))
w.writer.WriteMultiBuffer(buf.NewMultiBufferValue(frame))
w.writer.WriteMultiBuffer(buf.NewMultiBufferValue(frame)) // nolint: errcheck
return nil
}