From 5aec4b7f283da81aab1e3a9d56fa0e5e09e1b6c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=97=E5=AE=87?= Date: Fri, 6 Mar 2020 21:17:25 +0800 Subject: [PATCH] Updated vendor. --- go.mod | 4 ++-- go.sum | 4 ++-- vendor/github.com/SkycoinProject/dmsg/client.go | 2 +- .../github.com/SkycoinProject/dmsg/disc/entry.go | 3 +++ vendor/github.com/SkycoinProject/dmsg/server.go | 16 ++++++++-------- vendor/modules.txt | 2 +- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 30d7487b40..ed3b51bbae 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/SkycoinProject/skywire-mainnet go 1.13 require ( - github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb + github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 github.com/SkycoinProject/skycoin v0.27.0 github.com/SkycoinProject/yamux v0.0.0-20191213015001-a36efeefbf6a github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 @@ -27,4 +27,4 @@ require ( golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect ) -replace github.com/SkycoinProject/dmsg => ../dmsg +//replace github.com/SkycoinProject/dmsg => ../dmsg diff --git a/go.sum b/go.sum index 4f8b15bed3..0242aab9b0 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= -github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb h1:UPgo4kZ/nFV4jI9djG0esOyZjda4IZGZpGl/ntYRyuM= -github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb/go.mod h1:DzykXMLlx6Fx0fGjZsCIRas/MIvxW8DZpmDA6f2nCRk= +github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 h1:ce/1vcQhEX+8TkwX4PUUE2BVHA4sHNCPf8af7OVhPVE= +github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9/go.mod h1:DzykXMLlx6Fx0fGjZsCIRas/MIvxW8DZpmDA6f2nCRk= github.com/SkycoinProject/skycoin v0.26.0/go.mod h1:xqPLOKh5B6GBZlGA7B5IJfQmCy7mwimD9NlqxR3gMXo= github.com/SkycoinProject/skycoin v0.27.0 h1:N3IHxj8ossHOcsxLYOYugT+OaELLncYHJHxbbYLPPmY= github.com/SkycoinProject/skycoin v0.27.0/go.mod h1:xqPLOKh5B6GBZlGA7B5IJfQmCy7mwimD9NlqxR3gMXo= diff --git a/vendor/github.com/SkycoinProject/dmsg/client.go b/vendor/github.com/SkycoinProject/dmsg/client.go index 4eeeefb07d..083b0a298c 100644 --- a/vendor/github.com/SkycoinProject/dmsg/client.go +++ b/vendor/github.com/SkycoinProject/dmsg/client.go @@ -157,7 +157,7 @@ func (ce *Client) Ready() <-chan struct{} { } func (ce *Client) discoverServers(ctx context.Context) (entries []*disc.Entry, err error) { - err = netutil.NewDefaultRetrier(ce.log).Do(ctx, func() error { + err = netutil.NewDefaultRetrier(ce.log.WithField("func", "discoverServers")).Do(ctx, func() error { entries, err = ce.dc.AvailableServers(ctx) return err }) diff --git a/vendor/github.com/SkycoinProject/dmsg/disc/entry.go b/vendor/github.com/SkycoinProject/dmsg/disc/entry.go index c5e93fb52c..c3066e9121 100644 --- a/vendor/github.com/SkycoinProject/dmsg/disc/entry.go +++ b/vendor/github.com/SkycoinProject/dmsg/disc/entry.go @@ -16,6 +16,8 @@ const currentVersion = "0.0.1" var ( // ErrKeyNotFound occurs in case when entry of public key is not found ErrKeyNotFound = errors.New("entry of public key is not found") + // ErrNoAvailableServers occurs when dmsg client cannot find any delegated servers available for the given remote. + ErrNoAvailableServers = errors.New("no delegated dmsg servers available for remote") // ErrUnexpected occurs in case when something unexpected happened ErrUnexpected = errors.New("something unexpected happened") // ErrUnauthorized occurs in case of invalid signature @@ -45,6 +47,7 @@ var ( errReverseMap = map[string]error{ ErrKeyNotFound.Error(): ErrKeyNotFound, + ErrNoAvailableServers.Error(): ErrNoAvailableServers, ErrUnexpected.Error(): ErrUnexpected, ErrUnauthorized.Error(): ErrUnauthorized, ErrBadInput.Error(): ErrBadInput, diff --git a/vendor/github.com/SkycoinProject/dmsg/server.go b/vendor/github.com/SkycoinProject/dmsg/server.go index f070ed7136..eb2a8161d1 100644 --- a/vendor/github.com/SkycoinProject/dmsg/server.go +++ b/vendor/github.com/SkycoinProject/dmsg/server.go @@ -75,7 +75,6 @@ func (s *Server) Serve(lis net.Listener, addr string) error { Info("Stopping server, net.Listener closed.") }() - log.Info("Updating discovery entry...") if addr == "" { addr = lis.Addr().String() } @@ -95,6 +94,14 @@ func (s *Server) Serve(lis net.Listener, addr string) error { return err } + // TODO(evanlinjin): Implement proper load-balancing. + if s.SessionCount() >= s.maxSessions { + s.log. + WithField("max_sessions", s.maxSessions). + WithField("remote_tcp", conn.RemoteAddr()). + Debug("Max sessions is reached, but still accepting so clients who delegated us can still listen.") + } + s.wg.Add(1) go func(conn net.Conn) { s.handleSession(conn) @@ -126,13 +133,6 @@ func (s *Server) updateEntryLoop(addr string) error { func (s *Server) handleSession(conn net.Conn) { log := logrus.FieldLogger(s.log.WithField("remote_tcp", conn.RemoteAddr())) - if s.SessionCount() >= s.maxSessions { - s.log.WithError(conn.Close()). - WithField("max_sessions", s.maxSessions). - Warn("Session rejected: max sessions reached.") - return - } - dSes, err := makeServerSession(&s.EntityCommon, conn) if err != nil { log = log.WithError(err) diff --git a/vendor/modules.txt b/vendor/modules.txt index 22ec8c199d..f854256bb5 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# github.com/SkycoinProject/dmsg v0.0.0-20200304115237-130cc9d98ffb => ../dmsg +# github.com/SkycoinProject/dmsg v0.0.0-20200306131535-fabb2c8177e9 github.com/SkycoinProject/dmsg github.com/SkycoinProject/dmsg/cipher github.com/SkycoinProject/dmsg/disc