mirror of
https://github.com/xtaci/kcptun.git
synced 2024-04-21 12:32:32 +00:00
upd deps to kcp-go@v5.6.8
This commit is contained in:
@@ -4,7 +4,7 @@ require (
|
||||
github.com/golang/snappy v0.0.4
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/urfave/cli v1.22.14
|
||||
github.com/xtaci/kcp-go/v5 v5.6.7
|
||||
github.com/xtaci/kcp-go/v5 v5.6.8
|
||||
github.com/xtaci/smux v1.5.24
|
||||
github.com/xtaci/tcpraw v1.2.25
|
||||
golang.org/x/crypto v0.17.0
|
||||
|
||||
@@ -63,6 +63,8 @@ github.com/xtaci/kcp-go/v5 v5.6.6 h1:SxSjZoaaLzQKxbIfzE1FYLMKtR2veox5mvKO7AliZ5I
|
||||
github.com/xtaci/kcp-go/v5 v5.6.6/go.mod h1:oE9j2NVqAkuKO5o8ByKGch3vgVX3BNf8zqP8JiGq0bM=
|
||||
github.com/xtaci/kcp-go/v5 v5.6.7 h1:7+rnxNFIsjEwTXQk4cSZpXM4pO0hqtpwE1UFFoJBffA=
|
||||
github.com/xtaci/kcp-go/v5 v5.6.7/go.mod h1:oE9j2NVqAkuKO5o8ByKGch3vgVX3BNf8zqP8JiGq0bM=
|
||||
github.com/xtaci/kcp-go/v5 v5.6.8 h1:jlI/0jAyjoOjT/SaGB58s4bQMJiNS41A2RKzR6TMWeI=
|
||||
github.com/xtaci/kcp-go/v5 v5.6.8/go.mod h1:oE9j2NVqAkuKO5o8ByKGch3vgVX3BNf8zqP8JiGq0bM=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae h1:J0GxkO96kL4WF+AIT3M4mfUVinOCPgf2uUWYFUzN0sM=
|
||||
github.com/xtaci/lossyconn v0.0.0-20190602105132-8df528c0c9ae/go.mod h1:gXtu8J62kEgmN++bm9BVICuT/e8yiLI2KFobd/TRFsE=
|
||||
github.com/xtaci/smux v1.5.24 h1:77emW9dtnOxxOQ5ltR+8BbsX1kzcOxQ5gB+aaV9hXOY=
|
||||
|
||||
+13
-3
@@ -195,6 +195,7 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
|
||||
|
||||
// Read implements net.Conn
|
||||
func (s *UDPSession) Read(b []byte) (n int, err error) {
|
||||
RESET_TIMER:
|
||||
var timeout *time.Timer
|
||||
// deadline for current reading operation
|
||||
var c <-chan time.Time
|
||||
@@ -243,6 +244,10 @@ func (s *UDPSession) Read(b []byte) (n int, err error) {
|
||||
// wait for read event or timeout or error
|
||||
select {
|
||||
case <-s.chReadEvent:
|
||||
if timeout != nil {
|
||||
timeout.Stop()
|
||||
goto RESET_TIMER
|
||||
}
|
||||
case <-c:
|
||||
return 0, errors.WithStack(errTimeout)
|
||||
case <-s.chSocketReadError:
|
||||
@@ -258,6 +263,7 @@ func (s *UDPSession) Write(b []byte) (n int, err error) { return s.WriteBuffers(
|
||||
|
||||
// WriteBuffers write a vector of byte slices to the underlying connection
|
||||
func (s *UDPSession) WriteBuffers(v [][]byte) (n int, err error) {
|
||||
RESET_TIMER:
|
||||
var timeout *time.Timer
|
||||
var c <-chan time.Time
|
||||
if !s.wd.IsZero() {
|
||||
@@ -308,6 +314,10 @@ func (s *UDPSession) WriteBuffers(v [][]byte) (n int, err error) {
|
||||
|
||||
select {
|
||||
case <-s.chWriteEvent:
|
||||
if timeout != nil {
|
||||
timeout.Stop()
|
||||
goto RESET_TIMER
|
||||
}
|
||||
case <-c:
|
||||
return 0, errors.WithStack(errTimeout)
|
||||
case <-s.chSocketWriteError:
|
||||
@@ -375,9 +385,9 @@ func (s *UDPSession) RemoteAddr() net.Addr { return s.remote }
|
||||
// SetDeadline sets the deadline associated with the listener. A zero time value disables the deadline.
|
||||
func (s *UDPSession) SetDeadline(t time.Time) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.rd = t
|
||||
s.wd = t
|
||||
s.mu.Unlock()
|
||||
s.notifyReadEvent()
|
||||
s.notifyWriteEvent()
|
||||
return nil
|
||||
@@ -386,8 +396,8 @@ func (s *UDPSession) SetDeadline(t time.Time) error {
|
||||
// SetReadDeadline implements the Conn SetReadDeadline method.
|
||||
func (s *UDPSession) SetReadDeadline(t time.Time) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.rd = t
|
||||
s.mu.Unlock()
|
||||
s.notifyReadEvent()
|
||||
return nil
|
||||
}
|
||||
@@ -395,8 +405,8 @@ func (s *UDPSession) SetReadDeadline(t time.Time) error {
|
||||
// SetWriteDeadline implements the Conn SetWriteDeadline method.
|
||||
func (s *UDPSession) SetWriteDeadline(t time.Time) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.wd = t
|
||||
s.mu.Unlock()
|
||||
s.notifyWriteEvent()
|
||||
return nil
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ github.com/tjfoc/gmsm/sm4
|
||||
# github.com/urfave/cli v1.22.14
|
||||
## explicit; go 1.11
|
||||
github.com/urfave/cli
|
||||
# github.com/xtaci/kcp-go/v5 v5.6.7
|
||||
# github.com/xtaci/kcp-go/v5 v5.6.8
|
||||
## explicit; go 1.21
|
||||
github.com/xtaci/kcp-go/v5
|
||||
# github.com/xtaci/smux v1.5.24
|
||||
|
||||
Reference in New Issue
Block a user