mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-14 18:09:05 +00:00
Fix bug
This commit is contained in:
@@ -45,7 +45,7 @@ func (w *PipeConnWrapper) Close() error {
|
|||||||
|
|
||||||
func (w *PipeConnWrapper) Read(b []byte) (n int, err error) {
|
func (w *PipeConnWrapper) Read(b []byte) (n int, err error) {
|
||||||
w.T.Update()
|
w.T.Update()
|
||||||
n, err = w.Read(b)
|
n, err = w.R.Read(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// uplinkonly
|
// uplinkonly
|
||||||
w.T.SetTimeout(3 * time.Second)
|
w.T.SetTimeout(3 * time.Second)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package shadowsocks_2022
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"time"
|
||||||
|
|
||||||
shadowsocks "github.com/sagernet/sing-shadowsocks"
|
shadowsocks "github.com/sagernet/sing-shadowsocks"
|
||||||
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
||||||
@@ -18,6 +19,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
|
"github.com/xtls/xray-core/common/signal"
|
||||||
"github.com/xtls/xray-core/common/singbridge"
|
"github.com/xtls/xray-core/common/singbridge"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
"github.com/xtls/xray-core/transport/internet/stat"
|
"github.com/xtls/xray-core/transport/internet/stat"
|
||||||
@@ -152,6 +154,9 @@ func (i *Inbound) NewPacketConnection(ctx context.Context, conn N.PacketConn, me
|
|||||||
Reader: link.Reader,
|
Reader: link.Reader,
|
||||||
Writer: link.Writer,
|
Writer: link.Writer,
|
||||||
Dest: destination,
|
Dest: destination,
|
||||||
|
T: signal.CancelAfterInactivity(ctx, func() {
|
||||||
|
common.Interrupt(link.Reader)
|
||||||
|
}, 300*time.Second),
|
||||||
}
|
}
|
||||||
return bufio.CopyPacketConn(ctx, conn, outConn)
|
return bufio.CopyPacketConn(ctx, conn, outConn)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
||||||
C "github.com/sagernet/sing/common"
|
C "github.com/sagernet/sing/common"
|
||||||
@@ -22,6 +23,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
|
"github.com/xtls/xray-core/common/signal"
|
||||||
"github.com/xtls/xray-core/common/singbridge"
|
"github.com/xtls/xray-core/common/singbridge"
|
||||||
"github.com/xtls/xray-core/common/uuid"
|
"github.com/xtls/xray-core/common/uuid"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
@@ -273,6 +275,9 @@ func (i *MultiUserInbound) NewPacketConnection(ctx context.Context, conn N.Packe
|
|||||||
Reader: link.Reader,
|
Reader: link.Reader,
|
||||||
Writer: link.Writer,
|
Writer: link.Writer,
|
||||||
Dest: destination,
|
Dest: destination,
|
||||||
|
T: signal.CancelAfterInactivity(ctx, func() {
|
||||||
|
common.Interrupt(link.Reader)
|
||||||
|
}, 300*time.Second),
|
||||||
}
|
}
|
||||||
return bufio.CopyPacketConn(ctx, conn, outConn)
|
return bufio.CopyPacketConn(ctx, conn, outConn)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
"github.com/sagernet/sing-shadowsocks/shadowaead_2022"
|
||||||
C "github.com/sagernet/sing/common"
|
C "github.com/sagernet/sing/common"
|
||||||
@@ -20,6 +21,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
|
"github.com/xtls/xray-core/common/signal"
|
||||||
"github.com/xtls/xray-core/common/singbridge"
|
"github.com/xtls/xray-core/common/singbridge"
|
||||||
"github.com/xtls/xray-core/common/uuid"
|
"github.com/xtls/xray-core/common/uuid"
|
||||||
"github.com/xtls/xray-core/features/routing"
|
"github.com/xtls/xray-core/features/routing"
|
||||||
@@ -177,6 +179,9 @@ func (i *RelayInbound) NewPacketConnection(ctx context.Context, conn N.PacketCon
|
|||||||
Reader: link.Reader,
|
Reader: link.Reader,
|
||||||
Writer: link.Writer,
|
Writer: link.Writer,
|
||||||
Dest: destination,
|
Dest: destination,
|
||||||
|
T: signal.CancelAfterInactivity(ctx, func() {
|
||||||
|
common.Interrupt(link.Reader)
|
||||||
|
}, 300*time.Second),
|
||||||
}
|
}
|
||||||
return bufio.CopyPacketConn(ctx, conn, outConn)
|
return bufio.CopyPacketConn(ctx, conn, outConn)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/session"
|
"github.com/xtls/xray-core/common/session"
|
||||||
|
"github.com/xtls/xray-core/common/signal"
|
||||||
"github.com/xtls/xray-core/common/singbridge"
|
"github.com/xtls/xray-core/common/singbridge"
|
||||||
"github.com/xtls/xray-core/transport"
|
"github.com/xtls/xray-core/transport"
|
||||||
"github.com/xtls/xray-core/transport/internet"
|
"github.com/xtls/xray-core/transport/internet"
|
||||||
@@ -142,6 +143,9 @@ func (o *Outbound) Process(ctx context.Context, link *transport.Link, dialer int
|
|||||||
Writer: link.Writer,
|
Writer: link.Writer,
|
||||||
Conn: inboundConn,
|
Conn: inboundConn,
|
||||||
Dest: destination,
|
Dest: destination,
|
||||||
|
T: signal.CancelAfterInactivity(ctx, func() {
|
||||||
|
common.Interrupt(link.Reader)
|
||||||
|
}, 300*time.Second),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user