mirror of https://github.com/v2ray/v2ray-core
				
				
				
			fix lint errors
							parent
							
								
									b453190e58
								
							
						
					
					
						commit
						fde877e276
					
				| 
						 | 
				
			
			@ -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
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue