5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-12-23 02:55:39 +00:00

Remove metadata-peer association until we have some sensible way to cache it

This commit is contained in:
Neil Alexander 2018-12-12 22:58:16 +00:00
parent 2056e75ad5
commit 64060a447c
No known key found for this signature in database
GPG Key ID: A02A2019A2BB0944
4 changed files with 4 additions and 7 deletions

View File

@ -86,7 +86,6 @@ type peer struct {
shared boxSharedKey
linkShared boxSharedKey
endpoint string
metadata metadata
firstSeen time.Time // To track uptime for getPeers
linkOut (chan []byte) // used for protocol traffic (to bypass queues)
doSend (chan struct{}) // tell the linkLoop to send a switchMsg
@ -96,14 +95,13 @@ type peer struct {
}
// Creates a new peer with the specified box, sig, and linkShared keys, using the lowest unocupied port number.
func (ps *peers) newPeer(box *boxPubKey, sig *sigPubKey, linkShared *boxSharedKey, endpoint string, metadata metadata) *peer {
func (ps *peers) newPeer(box *boxPubKey, sig *sigPubKey, linkShared *boxSharedKey, endpoint string) *peer {
now := time.Now()
p := peer{box: *box,
sig: *sig,
shared: *getSharedKey(&ps.core.boxPriv, box),
linkShared: *linkShared,
endpoint: endpoint,
metadata: metadata,
firstSeen: now,
doSend: make(chan struct{}, 1),
core: ps.core}

View File

@ -58,9 +58,7 @@ func (r *router) init(core *Core) {
r.addr = *address_addrForNodeID(&r.core.dht.nodeID)
r.subnet = *address_subnetForNodeID(&r.core.dht.nodeID)
in := make(chan []byte, 32) // TODO something better than this...
r.core.sessions.myMetadataMutex.RLock()
p := r.core.peers.newPeer(&r.core.boxPub, &r.core.sigPub, &boxSharedKey{}, "(self)", r.core.sessions.myMetadata)
r.core.sessions.myMetadataMutex.RUnlock()
p := r.core.peers.newPeer(&r.core.boxPub, &r.core.sigPub, &boxSharedKey{}, "(self)")
p.out = func(packet []byte) {
// This is to make very sure it never blocks
select {

View File

@ -546,6 +546,7 @@ func (ss *sessions) handleMetadata(meta *sessionMeta) {
if meta.IsResponse {
sinfo.theirMetadata = meta.Metadata
sinfo.metaResTime = time.Now()
} else {
ss.sendMetadata(sinfo, true)
}

View File

@ -287,7 +287,7 @@ func (iface *tcpInterface) handler(sock net.Conn, incoming bool) {
}()
// Note that multiple connections to the same node are allowed
// E.g. over different interfaces
p := iface.core.peers.newPeer(&info.box, &info.sig, getSharedKey(myLinkPriv, &meta.link), sock.RemoteAddr().String(), metadata{})
p := iface.core.peers.newPeer(&info.box, &info.sig, getSharedKey(myLinkPriv, &meta.link), sock.RemoteAddr().String())
p.linkOut = make(chan []byte, 1)
in := func(bs []byte) {
p.handlePacket(bs)