Projects STRLCPY tun2socks Commits c61d7b5a
🤬
  • ■ ■ ■ ■ ■ ■
    tunnel/tcp.go
    skipped 78 lines
    79 79   defer pool.Put(buf)
    80 80   
    81 81   _, err := io.CopyBuffer(dst, src, buf)
     82 + if err != nil && !isIgnorable(err) {
     83 + return err
     84 + }
     85 + return nil
     86 +}
     87 + 
     88 +func isIgnorable(err error) bool {
    82 89   if ne, ok := err.(net.Error); ok && ne.Timeout() {
    83  - return nil /* ignore I/O timeout */
     90 + return true /* ignore I/O timeout */
    84 91   } else if errors.Is(err, syscall.EPIPE) {
    85  - return nil /* ignore broken pipe */
     92 + return true /* ignore broken pipe */
    86 93   } else if errors.Is(err, syscall.ECONNRESET) {
    87  - return nil /* ignore connection reset by peer */
     94 + return true /* ignore connection reset by peer */
    88 95   }
    89  - return err
     96 + return false
    90 97  }
    91 98   
Please wait...
Page is in error, reload to recover