mirror of
https://github.com/kubenetworks/kubevpn.git
synced 2025-10-18 05:10:41 +08:00
refactor: refactor code (#371)
This commit is contained in:
@@ -89,7 +89,7 @@ func transportTunClient(ctx context.Context, tunInbound <-chan *DataElem, tunOut
|
||||
_, err := packetConn.WriteTo(e.data[:e.length], remoteAddr)
|
||||
config.LPool.Put(e.data[:])
|
||||
if err != nil {
|
||||
errChan <- errors.Wrap(err, fmt.Sprintf("failed to write packet to remote %s", remoteAddr))
|
||||
util.SafeWrite(errChan, errors.Wrap(err, fmt.Sprintf("failed to write packet to remote %s", remoteAddr)))
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func transportTunClient(ctx context.Context, tunInbound <-chan *DataElem, tunOut
|
||||
b := config.LPool.Get().([]byte)[:]
|
||||
n, _, err := packetConn.ReadFrom(b[:])
|
||||
if err != nil {
|
||||
errChan <- errors.Wrap(err, fmt.Sprintf("failed to read packet from remote %s", remoteAddr))
|
||||
util.SafeWrite(errChan, errors.Wrap(err, fmt.Sprintf("failed to read packet from remote %s", remoteAddr)))
|
||||
return
|
||||
}
|
||||
util.SafeWrite(tunOutbound, &DataElem{data: b[:], length: n})
|
||||
|
Reference in New Issue
Block a user