Skip to content

Commit

Permalink
add simple heartbeat process for stcpr
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpalide committed May 2, 2024
1 parent f92b557 commit 6a856dd
Showing 1 changed file with 12 additions and 0 deletions.
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)
}

0 comments on commit 6a856dd

Please sign in to comment.