mirror of
https://github.com/SagerNet/sing-quic.git
synced 2025-04-03 03:47:39 +03:00
Fix missing user context in packet connections
This commit is contained in:
parent
09515f87e1
commit
077075e9b6
2 changed files with 4 additions and 2 deletions
|
@ -2,6 +2,7 @@ package hysteria2
|
|||
|
||||
import (
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/auth"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
)
|
||||
|
@ -37,7 +38,7 @@ func (s *serverSession[U]) handleUDPMessage(message *udpMessage) {
|
|||
udpConn, loaded := s.udpConnMap[message.sessionID]
|
||||
s.udpAccess.RUnlock()
|
||||
if !loaded || common.Done(udpConn.ctx) {
|
||||
udpConn = newUDPPacketConn(s.ctx, s.quicConn, func() {
|
||||
udpConn = newUDPPacketConn(auth.ContextWithUser(s.ctx, s.authUser), s.quicConn, func() {
|
||||
s.udpAccess.Lock()
|
||||
delete(s.udpConnMap, message.sessionID)
|
||||
s.udpAccess.Unlock()
|
||||
|
|
|
@ -2,6 +2,7 @@ package tuic
|
|||
|
||||
import (
|
||||
"github.com/sagernet/sing/common"
|
||||
"github.com/sagernet/sing/common/auth"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
)
|
||||
|
@ -55,7 +56,7 @@ func (s *serverSession[U]) handleUDPMessage(message *udpMessage, udpStream bool)
|
|||
udpConn, loaded := s.udpConnMap[message.sessionID]
|
||||
s.udpAccess.RUnlock()
|
||||
if !loaded || common.Done(udpConn.ctx) {
|
||||
udpConn = newUDPPacketConn(s.ctx, s.quicConn, udpStream, true, func() {
|
||||
udpConn = newUDPPacketConn(auth.ContextWithUser(s.ctx, s.authUser), s.quicConn, udpStream, true, func() {
|
||||
s.udpAccess.Lock()
|
||||
delete(s.udpConnMap, message.sessionID)
|
||||
s.udpAccess.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue