File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -262,6 +262,9 @@ func (ip *icmpProxy) Serve(ctx context.Context) error {
262262 return ctx .Err ()
263263}
264264
265+ // Request sends an ICMP echo request and wait for a reply or timeout.
266+ // The async version of Win32 APIs take a callback whose memory is not garbage collected, so we use the synchronous version.
267+ // It's possible that a slow request will block other requests, so we set the timeout to only 1s.
265268func (ip * icmpProxy ) Request (pk * packet.ICMP , responder packet.FunnelUniPipe ) error {
266269 if pk == nil {
267270 return errPacketNil
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import (
1111type ICMPRouter interface {
1212 // Serve starts listening for responses to the requests until context is done
1313 Serve (ctx context.Context ) error
14- // Request sends an ICMP message
14+ // Request sends an ICMP message. Implementations should not modify pk after the function returns.
1515 Request (pk * ICMP , responder FunnelUniPipe ) error
1616}
1717
You can’t perform that action at this time.
0 commit comments