check up if peer is sourced.
This commit is contained in:
@@ -367,26 +367,6 @@ func ConnectToIndexers(h host.Host, minIndexer int, maxIndexer int, myPID pp.ID)
|
||||
logger.Err(err)
|
||||
continue
|
||||
}
|
||||
/*for _, proto := range []protocol.ID{ProtocolPublish, ProtocolGet, ProtocolHeartbeat} {
|
||||
if stream, err := TempStream(h, *ad, proto); err == nil {
|
||||
StreamMuIndexes.Lock()
|
||||
if StreamIndexers[proto] == nil {
|
||||
StreamIndexers[proto] = map[pp.ID]*Stream{}
|
||||
}
|
||||
time.AfterFunc(2*time.Second, func() {
|
||||
StreamMuIndexes.Lock()
|
||||
defer StreamMuIndexes.Unlock()
|
||||
delete(StreamIndexers[proto], ad.ID)
|
||||
})
|
||||
StreamIndexers[proto][ad.ID] = &Stream{
|
||||
Stream: stream,
|
||||
Expiry: time.Now().UTC().Add(2 * time.Second),
|
||||
}
|
||||
StreamMuIndexes.Unlock()
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
}*/
|
||||
StaticIndexers[indexerAddr] = ad
|
||||
}
|
||||
|
||||
|
||||
@@ -214,7 +214,12 @@ func (d *Node) claimInfo(
|
||||
if endPoint == "" {
|
||||
return nil, errors.New("no endpoint found for peer")
|
||||
}
|
||||
peerID := uuid.New().String()
|
||||
did := uuid.New().String()
|
||||
|
||||
peers := oclib.NewRequestAdmin(oclib.LibDataEnum(oclib.PEER), nil).Search(nil, fmt.Sprintf("%v", peer.SELF), false)
|
||||
if len(peers.Data) > 0 {
|
||||
did = peers.Data[0].GetID() // if already existing set up did as made
|
||||
}
|
||||
priv, err := tools.LoadKeyFromFilePrivate()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -233,7 +238,7 @@ func (d *Node) claimInfo(
|
||||
|
||||
rec := &indexer.PeerRecord{
|
||||
Name: name,
|
||||
DID: peerID, // REAL PEER ID
|
||||
DID: did, // REAL PEER ID
|
||||
PubKey: pubBytes,
|
||||
}
|
||||
|
||||
@@ -261,7 +266,7 @@ func (d *Node) claimInfo(
|
||||
fmt.Println("Verify")
|
||||
return nil, err
|
||||
} else {*/
|
||||
_, p, err := rec.ExtractPeer(peerID, peerID, pub)
|
||||
_, p, err := rec.ExtractPeer(did, did, pub)
|
||||
return p, err
|
||||
//}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user