go-libp2p icon indicating copy to clipboard operation
go-libp2p copied to clipboard

limit ping duration to 30s

Open vyzo opened this issue 3 years ago • 3 comments

so that ping streams cannot be squatted

vyzo avatar Mar 14 '22 09:03 vyzo

What else can we do? We cant let the other side ping ad infinum and squat the resources.

What do you recommend doing about logging?

vyzo avatar Mar 14 '22 12:03 vyzo

What else can we do? We cant let the other side ping ad infinum and squat the resources.

True. There are multiple options:

  1. We could limit the client side to the same value though, so that a well-behaved client would not run into that error. That however would require making this duration a protocol constant.
  2. Instead of resetting the stream, we could close the write side of the stream and reset the read side, and define stream closing as "normal shutdown". The client could then suppress the error when it receives the stream reset (on its write-side of the stream).
  3. Or maybe all of this is too complex and we can just live with it?

What do you recommend doing about logging?

We can special-case the deadline error, and either not log anything, or log "ping aborted after 30s" when it occurred.

marten-seemann avatar Mar 14 '22 12:03 marten-seemann

want to take it over and mold it to suit your taste?

vyzo avatar Mar 14 '22 13:03 vyzo