Skip to content

Commit 812c0ba

Browse files
committed
timeout identify exchange
1 parent 2317f90 commit 812c0ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/crawl/crawl_p2p.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ func (c *Crawler) fetchNeighbors(ctx context.Context, pi peer.AddrInfo) (*Routin
215215
// identified in the past. We detect a successful identification if an
216216
// AgentVersion is stored in the peer store
217217
func (c *Crawler) identifyWait(ctx context.Context, pi peer.AddrInfo) {
218-
idCtx, cancel := context.WithCancel(ctx)
218+
timeoutCtx, cancel := context.WithTimeout(ctx, 15*time.Second)
219219
defer cancel()
220220

221221
var wg sync.WaitGroup
@@ -227,7 +227,7 @@ func (c *Crawler) identifyWait(ctx context.Context, pi peer.AddrInfo) {
227227
defer wg.Done()
228228

229229
select {
230-
case <-idCtx.Done():
230+
case <-timeoutCtx.Done():
231231
case <-c.host.IDService().IdentifyWait(conn):
232232

233233
// check if identification was successful by looking for

0 commit comments

Comments
 (0)