From 1229133ff6600492bcc2f5e94800b795eec9e95f Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Mon, 27 May 2013 16:32:41 +0200 Subject: Fix watchdog function_clause Commit 0b7c87dc caused diameter_watchdog:restart/2 to start returning 'stop', so that a watchdog process for a listening transport that allowed multiple connections to the same peer would die one watchdog timeout after losing a connection. The new return value was supposed to be passed up to transition/2, but was instead passed to set_watchdog/1, resulting in a function_clause error. The resulting crash was harmless but unseemly. Not detected by dialyzer. Thanks to Aleksander Nycz. --- lib/diameter/src/base/diameter_watchdog.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl index 41c493ff20..88ccf630e2 100644 --- a/lib/diameter/src/base/diameter_watchdog.erl +++ b/lib/diameter/src/base/diameter_watchdog.erl @@ -505,7 +505,9 @@ set_watchdog(#watchdog{tw = TwInit, tref = TRef} = S) -> cancel(TRef), - S#watchdog{tref = erlang:start_timer(tw(TwInit), self(), tw)}. + S#watchdog{tref = erlang:start_timer(tw(TwInit), self(), tw)}; +set_watchdog(stop = No) -> + No. cancel(undefined) -> ok; -- cgit v1.2.3