alanmcgovern / Mono.Nat

UPNP and NAT-PMP port forwarding for .NET
https://github.com/mono/Mono.Nat
MIT License
163 stars 156 forks source link

Possible processing loop removal #28

Closed BaronGreenback closed 4 years ago

BaronGreenback commented 4 years ago

By moving the token re-assignment until after the event call, and adding the check onto the RaiseDeviceUnknown, the possibility of a loop whereby unit1 sends unknown message to Mono.NAT which sends it back to unit1 is removed.

alanmcgovern commented 4 years ago

I resolved this a slightly different way - https://github.com/alanmcgovern/Mono.Nat/commit/04754b1e5f139559736c41bf23c1752564d178d9

I used a boolean, which is a bit clearer/more deterministic, rather than rely on inferring the behaviour based on the cancellation token. Hope this works for you!

Great suggestion though!