aboutsummaryrefslogtreecommitdiffstats
path: root/lib/diameter/src/base/diameter_traffic.erl
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2015-06-19 13:26:19 +0200
committerAnders Svensson <[email protected]>2015-06-19 14:27:27 +0200
commitcb89a27002558f19f236febef877c5cf135c4c8d (patch)
tree26cb2e1d3bc1078472db43f517dc4dacfb0ed663 /lib/diameter/src/base/diameter_traffic.erl
parent207de95c123a0df754a6886011fc05a4b513a6a5 (diff)
downloadotp-cb89a27002558f19f236febef877c5cf135c4c8d.tar.gz
otp-cb89a27002558f19f236febef877c5cf135c4c8d.tar.bz2
otp-cb89a27002558f19f236febef877c5cf135c4c8d.zip
Ensure accepting processes are first in, first out
A listener process in diameter_sctp starts accepting transport processes as required, either as associations are established or as diameter asks for a processes to be started. Since this can happen in any order, the listener maintains two queues: one for processes that diameter has requested and which are waiting to be given an association, another for processes that have been started to become owners of an association but are waiting for diameter to request them. Only one queue at a time is non-empty. The first queue's length is bounded by the number of accepting processes configured as pool_size. Entries in the second queue are short-lived since diameter starts a replacement transport process whenever an existing one dies or communicates that it has an association. The two queues were previously implemented in an ets ordered_set, whose keys were the pid() of transport processes. Removing an element from the queue was then done with ets:first/1. The problem with this it's not really a queue: there's no guarantee that pid-ordering is the same as the order in which processes are started. If it isn't then it's possible that an established association never be given to diameter as a transport process if there's always a newer association whose pid sorts first. This isn't a problem in practice since it would require new associations to be established faster than diameter starts transport processes, but redo the implementation as a queue, with strict FIFO semantics.
Diffstat (limited to 'lib/diameter/src/base/diameter_traffic.erl')
0 files changed, 0 insertions, 0 deletions