From c7958e546c0c886f47a3075f7117a1cc59fe9fcc Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Wed, 14 Sep 2011 11:50:50 +0200 Subject: Handle #sctp_paddr_change and #sctp_pdapi_event from gen_sctp. The events are enabled by default but diameter_sctp neither disabled nor dealt with them. Reception of such an event caused a transport process to crash. --- lib/diameter/src/transport/diameter_sctp.erl | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lib/diameter/src/transport/diameter_sctp.erl') diff --git a/lib/diameter/src/transport/diameter_sctp.erl b/lib/diameter/src/transport/diameter_sctp.erl index 92aa8488a0..46473e7bf1 100644 --- a/lib/diameter/src/transport/diameter_sctp.erl +++ b/lib/diameter/src/transport/diameter_sctp.erl @@ -525,7 +525,22 @@ recv({[#sctp_sndrcvinfo{stream = Id}], Bin}, #transport{parent = Pid}) recv({[], #sctp_shutdown_event{assoc_id = Id}}, #transport{assoc_id = Id}) -> - stop. + stop; + +%% Note that diameter_sctp(3) documents that sctp_events cannot be +%% specified in the list of options passed to gen_sctp and that +%% gen_opts/1 guards against this. This is to ensure that we know what +%% events to expect and also to ensure that we receive +%% #sctp_sndrcvinfo{} with each incoming message (data_io_event = +%% true). Adaptation layer events (ie. #sctp_adaptation_event{}) are +%% disabled by default so don't handle it. We could simply disable +%% events we don't react to but don't. + +recv({[], #sctp_paddr_change{}}, _) -> + ok; + +recv({[], #sctp_pdapi_event{}}, _) -> + ok. %% up/1 @@ -591,7 +606,7 @@ f([], _, _) -> %% assoc_id/1 -assoc_id(#sctp_shutdown_event{assoc_id = Id}) -> %% undocumented +assoc_id(#sctp_shutdown_event{assoc_id = Id}) -> Id; assoc_id(#sctp_assoc_change{assoc_id = Id}) -> Id; -- cgit v1.2.3