Skip to content

Commit

Permalink
Merge pull request #1821 from mrpalide/feat/add-heartbeat-logic-for-a…
Browse files Browse the repository at this point in the history
…r-and-dmsg

add heartbeat logic for stcpr and dmsg
  • Loading branch information
mrpalide authored May 2, 2024
2 parents 787ba96 + 96ba9d6 commit 99062b2
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ require (
github.com/robert-nix/ansihtml v1.0.1
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
github.com/sirupsen/logrus v1.9.3
github.com/skycoin/dmsg v1.3.21
github.com/skycoin/dmsg v1.3.22-0.20240502214137-b684f7064155
github.com/skycoin/skycoin v0.27.1
github.com/skycoin/skycoin-service-discovery v0.0.0-20240306165129-2af10aca698e
github.com/skycoin/skywire-services v0.0.0-20240403004908-50ccbbf07004
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/skycoin/dmsg v1.3.21 h1:31Jx5pPAUDNUxZmLUORSspvo9OTdtXOBY++Tzb/jotM=
github.com/skycoin/dmsg v1.3.21/go.mod h1:INEDx+ECwCGQWw/Kd0QcLmSWMhbeRRcfkxj+xATQGFg=
github.com/skycoin/dmsg v1.3.22-0.20240502214137-b684f7064155 h1:yy/bheBsI2PXGgl3ose3avsBGSJnI0ukrCTdbB92pSc=
github.com/skycoin/dmsg v1.3.22-0.20240502214137-b684f7064155/go.mod h1:INEDx+ECwCGQWw/Kd0QcLmSWMhbeRRcfkxj+xATQGFg=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6 h1:1Nc5EBY6pjfw1kwW0duwyG+7WliWz5u9kgk1h5MnLuA=
github.com/skycoin/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:UXghlricA7J3aRD/k7p/zBObQfmBawwCxIVPVjz2Q3o=
github.com/skycoin/skycoin v0.27.1 h1:HatxsRwVSPaV4qxH6290xPBmkH/HgiuAoY2qC+e8C9I=
Expand Down
12 changes: 12 additions & 0 deletions pkg/transport/network/stcpr.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net"
"time"

"github.com/skycoin/skywire-utilities/pkg/cipher"
"github.com/skycoin/skywire-utilities/pkg/netutil"
Expand Down Expand Up @@ -89,6 +90,17 @@ func (c *stcprClient) serve() {
c.log.Errorf("Failed to bind STCPR: %v", err)
return
}
// simple heartbeat process for stcpr
go func() {
for {
time.Sleep(5 * time.Minute)
if err := c.ar.BindSTCPR(context.Background(), port); err != nil {
c.log.Errorf("Failed to bind STCPR: %v", err)
continue
}
c.log.Infof("STCPR rebinded in heartbeating process")
}
}()
c.log.Debugf("Successfully bound stcpr to port %s", port)
c.acceptTransports(lis)
}
8 changes: 7 additions & 1 deletion vendor/github.com/skycoin/dmsg/pkg/dmsg/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions vendor/github.com/skycoin/dmsg/pkg/dmsg/entity_common.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ github.com/shirou/gopsutil/process
## explicit; go 1.13
github.com/sirupsen/logrus
github.com/sirupsen/logrus/hooks/syslog
# github.com/skycoin/dmsg v1.3.21
# github.com/skycoin/dmsg v1.3.22-0.20240502214137-b684f7064155
## explicit; go 1.21
github.com/skycoin/dmsg/cmd/dmsg-discovery/commands
github.com/skycoin/dmsg/cmd/dmsg-server/commands
Expand Down

0 comments on commit 99062b2

Please sign in to comment.