erldns icon indicating copy to clipboard operation
erldns copied to clipboard

erldns_udp_server: Fix flow control

Open weiss opened this issue 3 years ago • 2 comments

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.)

weiss avatar Nov 01 '21 10:11 weiss

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).

weiss avatar Nov 09 '21 10:11 weiss

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.

DXTimer avatar Nov 09 '21 11:11 DXTimer