Skip to content

Commit

Permalink
fix: new control plane should reset grpc conn pool cache (#150)
Browse files Browse the repository at this point in the history
  • Loading branch information
mzz2017 committed Jun 18, 2023
1 parent d3dcfe6 commit 4d42b2d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/protocol/direct"
"net"
"net/http"
"os"
Expand All @@ -18,6 +15,10 @@ import (
"syscall"
"time"

"github.com/mzz2017/softwind/netproxy"
"github.com/mzz2017/softwind/pkg/fastrand"
"github.com/mzz2017/softwind/protocol/direct"

"github.com/daeuniverse/dae/cmd/internal"
"github.com/daeuniverse/dae/common"
"github.com/daeuniverse/dae/common/subscription"
Expand Down
3 changes: 3 additions & 0 deletions control/control_plane.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/mohae/deepcopy"
"github.com/mzz2017/softwind/pool"
"github.com/mzz2017/softwind/protocol/direct"
"github.com/mzz2017/softwind/transport/grpc"
"github.com/sirupsen/logrus"
"golang.org/x/net/dns/dnsmessage"
"golang.org/x/sys/unix"
Expand Down Expand Up @@ -262,6 +263,8 @@ func NewControlPlane(
}

// Filter out groups.
// FIXME: Ugly code here: reset grpc clients manually.
grpc.CleanGlobalClientConnectionCache()
dialerSet := outbound.NewDialerSetFromLinks(option, tagToNodeList)
deferFuncs = append(deferFuncs, dialerSet.Close)
for _, group := range groups {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/json-iterator/go v1.1.12
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826
github.com/mzz2017/softwind v0.0.0-20230617041556-c341d431c575
github.com/mzz2017/softwind v0.0.0-20230618055635-5c79a9138694
github.com/okzk/sdnotify v0.0.0-20180710141335-d9becc38acbd
github.com/safchain/ethtool v0.0.0-20230116090318-67cc41908669
github.com/sirupsen/logrus v1.9.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 h1:RWengNIwukTxcDr9
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwdSHYgviHp1DAtfrULt5eUgsSMsZf+YrPgl8=
github.com/mzz2017/disk-bloom v1.0.1 h1:rEF9MiXd9qMW3ibRpqcerLXULoTgRlM21yqqJl1B90M=
github.com/mzz2017/disk-bloom v1.0.1/go.mod h1:JLHETtUu44Z6iBmsqzkOtFlRvXSlKnxjwiBRDapizDI=
github.com/mzz2017/softwind v0.0.0-20230617041556-c341d431c575 h1:SdmqtK60s2yi9qghZ0CyECRkXDOGhp2wvhFxISi1spU=
github.com/mzz2017/softwind v0.0.0-20230617041556-c341d431c575/go.mod h1:1hn+ZsP9fLm17yEx0jyqxHkIKm5u2gBXVGIrnKsE1fY=
github.com/mzz2017/softwind v0.0.0-20230618055635-5c79a9138694 h1:qLBM6+Xt8JxWM4gkMuBOOn9Xy1aAcQorH4vEB8ibHls=
github.com/mzz2017/softwind v0.0.0-20230618055635-5c79a9138694/go.mod h1:1hn+ZsP9fLm17yEx0jyqxHkIKm5u2gBXVGIrnKsE1fY=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
Expand Down

0 comments on commit 4d42b2d

Please sign in to comment.