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 (
MARSHALED_PEERING_PORT_SIZE = 2
MARSHALED_GOSSIP_PORT_SIZE = 2
MARSHALED_SALT_SIZE = salt.SALT_MARSHALED_SIZE
MARSHALED_TOTAL_SIZE = MARSHALED_SALT_END
MARSHALED_TOTAL_SIZE = MARSHALED_SALT_END
)
......@@ -5,6 +5,7 @@ import (
"net"
"strconv"
"sync"
"time"
"github.com/iotaledger/goshimmer/packages/events"
"github.com/iotaledger/goshimmer/packages/identity"
......@@ -15,13 +16,17 @@ import (
)
type Peer struct {
Identity *identity.Identity
Address net.IP
PeeringPort uint16
GossipPort uint16
Salt *salt.Salt
Conn *network.ManagedConnection
connectMutex sync.Mutex
Identity *identity.Identity
Address net.IP
PeeringPort uint16
GossipPort uint16
Salt *salt.Salt
Conn *network.ManagedConnection
connectMutex sync.Mutex
firstSeen time.Time
firstSeenMutex sync.RWMutex
lastSeen time.Time
lastSeenMutex sync.RWMutex
}
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