Skip to content
Snippets Groups Projects
Commit 06f39953 authored by Hans Moog's avatar Hans Moog
Browse files

Feat: started adding timestamps to peers (to clean up offline nodes)

parent 51723c5d
No related branches found
No related tags found
No related merge requests found
...@@ -26,5 +26,6 @@ const ( ...@@ -26,5 +26,6 @@ const (
MARSHALED_PEERING_PORT_SIZE = 2 MARSHALED_PEERING_PORT_SIZE = 2
MARSHALED_GOSSIP_PORT_SIZE = 2 MARSHALED_GOSSIP_PORT_SIZE = 2
MARSHALED_SALT_SIZE = salt.SALT_MARSHALED_SIZE MARSHALED_SALT_SIZE = salt.SALT_MARSHALED_SIZE
MARSHALED_TOTAL_SIZE = MARSHALED_SALT_END
MARSHALED_TOTAL_SIZE = MARSHALED_SALT_END
) )
...@@ -5,6 +5,7 @@ import ( ...@@ -5,6 +5,7 @@ import (
"net" "net"
"strconv" "strconv"
"sync" "sync"
"time"
"github.com/iotaledger/goshimmer/packages/events" "github.com/iotaledger/goshimmer/packages/events"
"github.com/iotaledger/goshimmer/packages/identity" "github.com/iotaledger/goshimmer/packages/identity"
...@@ -15,13 +16,17 @@ import ( ...@@ -15,13 +16,17 @@ import (
) )
type Peer struct { type Peer struct {
Identity *identity.Identity Identity *identity.Identity
Address net.IP Address net.IP
PeeringPort uint16 PeeringPort uint16
GossipPort uint16 GossipPort uint16
Salt *salt.Salt Salt *salt.Salt
Conn *network.ManagedConnection Conn *network.ManagedConnection
connectMutex sync.Mutex connectMutex sync.Mutex
firstSeen time.Time
firstSeenMutex sync.RWMutex
lastSeen time.Time
lastSeenMutex sync.RWMutex
} }
func Unmarshal(data []byte) (*Peer, error) { func Unmarshal(data []byte) (*Peer, error) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment