Skip to content

Commit

Permalink
Merge pull request #13 from ICKelin/fix/quic_reconnect
Browse files Browse the repository at this point in the history
Fix/quic reconnect
  • Loading branch information
ICKelin authored Sep 7, 2024
2 parents e67277a + 95c6c72 commit 99aeb8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gtun/proxy/tproxy_tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ func (p *TProxyTCP) doProxy(conn net.Conn) {
logs.Debug("%s:%s=>%s:%s", sip, sport, dip, dport)
stream, err := sess.OpenStream()
if err != nil {
// force close to trigger reconnect
// quic CAN'T get close state by sess.IsClose()
// Close to trigger quic reconnect
sess.Close()
logs.Error("open stream fail: %v", err)
return
}
Expand Down
4 changes: 4 additions & 0 deletions src/gtun/proxy/tproxy_udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,10 @@ func (p *TProxyUDP) serve(lconn *net.UDPConn) error {

stream, err := sess.OpenStream()
if err != nil {
// force close to trigger reconnect
// quic CAN'T get close state by sess.IsClose()
// Close to trigger quic reconnect
sess.Close()
logs.Error("open stream fail: %v", err)
continue
}
Expand Down

0 comments on commit 99aeb8d

Please sign in to comment.