gabbhack / i2ptransport

I2P Transport for nim-libp2p.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

INVALID_ID error in accept after long connection

gabbhack opened this issue · comments

commented
import sequtils
import chronos
import stew/byteutils

import libp2p
import libp2p/protocols/rendezvous
import libp2p/discovery/rendezvousinterface
import libp2p/discovery/discoverymngr

import i2ptransport

proc createSwitch(samAddress: TransportAddress, i2pSettings: I2PSettings, rdv: RendezVous = RendezVous.new()): Switch =
  SwitchBuilder.new()
    .withRng(newRng())
    .withTransport(proc(upgr: Upgrade): Transport = I2PTransport.new(samAddress, i2pSettings, upgrade=upgr))
    .withYamux()
    .withNoise()
    .withRendezVous(rdv)
    .build()

proc main() {.async, gcsafe.} =
  let
    rdv = RendezVous.new()
    samAddress = initTAddress("127.0.0.1:7656")
    i2pSettings = I2PSettings.init("nickname")
    bootNode = createSwitch(samAddress, i2pSettings, rdv)

  await bootNode.start()
  while true:
    await sleepAsync(10.seconds)

waitFor(main())

I think the reason is that the control socket was closed by a timeout.