Skip to content
Snippets Groups Projects
Commit 11a2420a authored by capossele's avatar capossele
Browse files

Merge branch 'develop' into chores/dashboard-linter

parents b11c304e c4935568
No related branches found
No related tags found
No related merge requests found
...@@ -193,7 +193,7 @@ func neighborMetrics() []neighbormetric { ...@@ -193,7 +193,7 @@ func neighborMetrics() []neighbormetric {
stats := []neighbormetric{} stats := []neighbormetric{}
// gossip plugin might be disabled // gossip plugin might be disabled
neighbors := gossip.GetAllNeighbors() neighbors := gossip.Neighbors()
if neighbors == nil { if neighbors == nil {
return stats return stats
} }
......
...@@ -5,16 +5,15 @@ import ( ...@@ -5,16 +5,15 @@ import (
"net" "net"
"strconv" "strconv"
"github.com/iotaledger/hive.go/autopeering/peer/service"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/netutil"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message" "github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
gp "github.com/iotaledger/goshimmer/packages/gossip" gp "github.com/iotaledger/goshimmer/packages/gossip"
"github.com/iotaledger/goshimmer/packages/gossip/server" "github.com/iotaledger/goshimmer/packages/gossip/server"
"github.com/iotaledger/goshimmer/plugins/autopeering/local" "github.com/iotaledger/goshimmer/plugins/autopeering/local"
"github.com/iotaledger/goshimmer/plugins/config" "github.com/iotaledger/goshimmer/plugins/config"
"github.com/iotaledger/goshimmer/plugins/messagelayer" "github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/iotaledger/hive.go/autopeering/peer/service"
"github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/netutil"
) )
var ( var (
...@@ -27,9 +26,9 @@ func configureGossip() { ...@@ -27,9 +26,9 @@ func configureGossip() {
lPeer := local.GetInstance() lPeer := local.GetInstance()
// announce the gossip service // announce the gossip service
gossipPort := config.Node.GetInt(GOSSIP_PORT) gossipPort := config.Node.GetInt(CfgGossipPort)
if !netutil.IsValidPort(gossipPort) { if !netutil.IsValidPort(gossipPort) {
log.Fatalf("Invalid port number (%s): %d", GOSSIP_PORT, gossipPort) log.Fatalf("Invalid port number (%s): %d", CfgGossipPort, gossipPort)
} }
if err := lPeer.UpdateService(service.GossipKey, "tcp", gossipPort); err != nil { if err := lPeer.UpdateService(service.GossipKey, "tcp", gossipPort); err != nil {
...@@ -72,17 +71,18 @@ func start(shutdownSignal <-chan struct{}) { ...@@ -72,17 +71,18 @@ func start(shutdownSignal <-chan struct{}) {
} }
// loads the given message from the message layer or an error if not found. // loads the given message from the message layer or an error if not found.
func loadMessage(messageId message.Id) (bytes []byte, err error) { func loadMessage(messageID message.Id) (bytes []byte, err error) {
log.Debugw("load message from db", "id", messageId.String()) log.Debugw("load message from db", "id", messageID.String())
if !messagelayer.Tangle.Message(messageId).Consume(func(message *message.Message) { if !messagelayer.Tangle.Message(messageID).Consume(func(message *message.Message) {
bytes = message.Bytes() bytes = message.Bytes()
}) { }) {
err = fmt.Errorf("message not found: hash=%s", messageId) err = fmt.Errorf("message not found: hash=%s", messageID)
} }
return return
} }
func GetAllNeighbors() []*gp.Neighbor { // Neighbors returns the list of the neighbors.
func Neighbors() []*gp.Neighbor {
if mgr == nil { if mgr == nil {
return nil return nil
} }
......
...@@ -5,9 +5,10 @@ import ( ...@@ -5,9 +5,10 @@ import (
) )
const ( const (
GOSSIP_PORT = "gossip.port" // CfgGossipPort defines the config flag of the gossip port.
CfgGossipPort = "gossip.port"
) )
func init() { func init() {
flag.Int(GOSSIP_PORT, 14666, "tcp port for gossip connection") flag.Int(CfgGossipPort, 14666, "tcp port for gossip connection")
} }
package gossip package gossip
import ( import (
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/tangle"
"github.com/iotaledger/goshimmer/packages/gossip"
"github.com/iotaledger/goshimmer/packages/shutdown"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
"github.com/iotaledger/hive.go/autopeering/peer" "github.com/iotaledger/hive.go/autopeering/peer"
"github.com/iotaledger/hive.go/autopeering/selection" "github.com/iotaledger/hive.go/autopeering/selection"
"github.com/iotaledger/hive.go/daemon" "github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events" "github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/logger" "github.com/iotaledger/hive.go/logger"
"github.com/iotaledger/hive.go/node" "github.com/iotaledger/hive.go/node"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/message"
"github.com/iotaledger/goshimmer/packages/binary/messagelayer/tangle"
"github.com/iotaledger/goshimmer/packages/gossip"
"github.com/iotaledger/goshimmer/packages/shutdown"
"github.com/iotaledger/goshimmer/plugins/messagelayer"
) )
// PluginName is the name of the gossip plugin. // PluginName is the name of the gossip plugin.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment