Merge branch 'ind-bootstrap' into proc-debug

# Conflicts:
#	version.go
This commit is contained in:
David Vennik
2023-01-08 22:24:43 +00:00
8 changed files with 31 additions and 28 deletions

View File

@@ -2,16 +2,16 @@ package main
import (
"context"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"github.com/indra-labs/indra"
"github.com/indra-labs/indra/pkg/docker"
"github.com/indra-labs/indra/pkg/app"
"github.com/indra-labs/indra/pkg/cmds"
"github.com/indra-labs/indra/pkg/docker"
log2 "github.com/indra-labs/indra/pkg/log"
"github.com/indra-labs/indra/pkg/opts/config"
"github.com/indra-labs/indra/pkg/opts/meta"
"github.com/indra-labs/indra/pkg/opts/toggle"
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"os"
"time"
)

View File

@@ -105,11 +105,11 @@ var commands = &cmds.Command{
server.DefaultConfig.PrivKey = privKey
for _, listener := range c.GetListValue("listen"){
for _, listener := range c.GetListValue("listen") {
server.DefaultConfig.ListenAddresses = append(server.DefaultConfig.ListenAddresses, multiaddr.StringCast(listener))
}
for _, seed := range c.GetListValue("seed"){
for _, seed := range c.GetListValue("seed") {
server.DefaultConfig.SeedAddresses = append(server.DefaultConfig.SeedAddresses, multiaddr.StringCast(seed))
}

View File

@@ -29,7 +29,7 @@ func HostStatus(ctx context.Context, host host.Host) {
select {
case <- ctx.Done():
case <-ctx.Done():
log.I.Ln("shutting down metrics.hoststatus")
@@ -40,8 +40,8 @@ func HostStatus(ctx context.Context, host host.Host) {
}
log.I.Ln("---- host status ----")
log.I.Ln("-- peers:",len(host.Network().Peers()))
log.I.Ln("-- connections:",len(host.Network().Conns()))
log.I.Ln("-- peers:", len(host.Network().Peers()))
log.I.Ln("-- connections:", len(host.Network().Conns()))
log.I.Ln("---- ---- ------ ----")
}
}

View File

@@ -19,8 +19,9 @@ var (
var (
defaultConnectionAttempts uint = 3
defaultConnectionAttemptInterval time.Duration = 10 * time.Second
defaultConnectionAttemptInterval = 10 * time.Second
defaultConnectionsMax uint = 32
defaultConnectionsToSatisfy uint = 5
)
@@ -42,13 +43,16 @@ func connection_attempt(peer *peer.AddrInfo, attempts_left uint) {
return
}
if err := h.Connect(c, *peer); check(err) {
if err := h.Connect(c, *peer); err != nil {
log.D.Ln("connection connection_attempt failed:", peer.ID)
log.I.Ln("connection attempt failed:", peer.ID)
time.Sleep(defaultConnectionAttemptInterval)
connection_attempt(peer, attempts_left - 1)
select {
case <-time.After(defaultConnectionAttemptInterval):
connection_attempt(peer, attempts_left-1)
case <-c.Done():
wg.Done()
}
return
}

View File

@@ -22,7 +22,6 @@ var DefaultConfig = &Config{
}
type Config struct {
PrivKey crypto.PrivKey
PublicAddress multiaddr.Multiaddr

View File

@@ -20,7 +20,7 @@ var (
)
var (
userAgent = "/indra:"+indra.SemVer+"/"
userAgent = "/indra:" + indra.SemVer + "/"
)
type Server struct {

View File

@@ -7,7 +7,7 @@ import (
"testing"
)
func TestBase58(t *testing.T){
func TestBase58(t *testing.T) {
var err error
var priv1, priv2 crypto.PrivKey