erldns
erldns copied to clipboard
erldns_udp_server: Fix flow control
Reset the {active, N}
socket option only when receiving an udp_passive
message, rather than on every received packet, which provides no flow control and therefore no advantage over {active, true}
mode. (BTW, resetting {active, N}
actually adds N
to the current count, so adding 100
on every packet could in theory overflow the counter at some point.)
I should mention that I didn't actually test this change, sorry about that. I just stumbled over the code while looking into various UDP servers written in Erlang (I was trying to figure out sane UDP socket options for a TURN server).
Thanks, @weiss for opening the PR. I've checked the documentation and this does seem like a good approach. We will run some tests before we accept your contribution.