mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-15 13:41:23 +08:00
fix: tuic server set authentication timeout after quic handshake complete
This commit is contained in:
parent
9ae0bd9c2b
commit
6fe7f4641e
@ -76,7 +76,7 @@ func (s *Server) Close() error {
|
|||||||
|
|
||||||
type serverHandler struct {
|
type serverHandler struct {
|
||||||
*Server
|
*Server
|
||||||
quicConn quic.Connection
|
quicConn quic.EarlyConnection
|
||||||
uuid uuid.UUID
|
uuid uuid.UUID
|
||||||
|
|
||||||
authCh chan struct{}
|
authCh chan struct{}
|
||||||
@ -87,13 +87,6 @@ type serverHandler struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *serverHandler) handle() {
|
func (s *serverHandler) handle() {
|
||||||
time.AfterFunc(s.AuthenticationTimeout, func() {
|
|
||||||
s.authOnce.Do(func() {
|
|
||||||
_ = s.quicConn.CloseWithError(AuthenticationTimeout, "AuthenticationTimeout")
|
|
||||||
s.authOk = false
|
|
||||||
close(s.authCh)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
go func() {
|
go func() {
|
||||||
_ = s.handleUniStream()
|
_ = s.handleUniStream()
|
||||||
}()
|
}()
|
||||||
@ -103,6 +96,15 @@ func (s *serverHandler) handle() {
|
|||||||
go func() {
|
go func() {
|
||||||
_ = s.handleMessage()
|
_ = s.handleMessage()
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
<-s.quicConn.HandshakeComplete().Done()
|
||||||
|
time.AfterFunc(s.AuthenticationTimeout, func() {
|
||||||
|
s.authOnce.Do(func() {
|
||||||
|
_ = s.quicConn.CloseWithError(AuthenticationTimeout, "AuthenticationTimeout")
|
||||||
|
s.authOk = false
|
||||||
|
close(s.authCh)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *serverHandler) handleMessage() (err error) {
|
func (s *serverHandler) handleMessage() (err error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user