Browse Source

Fix compilation error in OTP < 24

This fixes this error:

src/ranch.erl:201: variable 'TransOpts' unsafe in 'try' (line 196)
src/ranch.erl:201: variable 'Transport' unsafe in 'try' (line 196)
Loïc Hoguin 2 years ago
parent
commit
6bbc8431d5
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/ranch.erl

+ 3 - 3
src/ranch.erl

@@ -194,9 +194,9 @@ start_error(_, Error) -> Error.
 -spec stop_listener(ref()) -> ok | {error, not_found}.
 -spec stop_listener(ref()) -> ok | {error, not_found}.
 stop_listener(Ref) ->
 stop_listener(Ref) ->
 	try
 	try
-		[_, Transport, _, _, _] = ranch_server:get_listener_start_args(Ref),
-		TransOpts = get_transport_options(Ref),
-		{Transport, TransOpts}
+		[_, Transport0, _, _, _] = ranch_server:get_listener_start_args(Ref),
+		TransOpts0 = get_transport_options(Ref),
+		{Transport0, TransOpts0}
 	of
 	of
 		{Transport, TransOpts} ->
 		{Transport, TransOpts} ->
 			case supervisor:terminate_child(ranch_sup, {ranch_listener_sup, Ref}) of
 			case supervisor:terminate_child(ranch_sup, {ranch_listener_sup, Ref}) of