@@ -63,55 +63,51 @@ close_connection(Pid, Reason) ->
6363
6464init ([SupHelperPid , Ref , Configuration ]) ->
6565 process_flag (trap_exit , true ),
66- ProxyProtocolEnabled = application :get_env (rabbitmq_stomp , proxy_protocol , false ),
67- case rabbit_networking :handshake (Ref , ProxyProtocolEnabled ) of
66+ {ok , Sock } = rabbit_networking :handshake (Ref ,
67+ application :get_env (rabbitmq_stomp , proxy_protocol , false )),
68+ RealSocket = rabbit_net :unwrap_socket (Sock ),
69+
70+ case rabbit_net :connection_string (Sock , inbound ) of
71+ {ok , ConnStr } ->
72+ ConnName = rabbit_data_coercion :to_binary (ConnStr ),
73+ ProcInitArgs = processor_args (Configuration , Sock ),
74+ ProcState = rabbit_stomp_processor :initial_state (Configuration ,
75+ ProcInitArgs ),
76+
77+ rabbit_log_connection :info (" accepting STOMP connection ~tp (~ts )" ,
78+ [self (), ConnName ]),
79+
80+ ParseState = rabbit_stomp_frame :initial_state (),
81+ _ = register_resource_alarm (),
82+
83+ LoginTimeout = application :get_env (rabbitmq_stomp , login_timeout , 10_000 ),
84+ MaxFrameSize = application :get_env (rabbitmq_stomp , max_frame_size , ? DEFAULT_MAX_FRAME_SIZE ),
85+ erlang :send_after (LoginTimeout , self (), login_timeout ),
86+
87+ gen_server2 :enter_loop (? MODULE , [],
88+ rabbit_event :init_stats_timer (
89+ run_socket (control_throttle (
90+ # reader_state {socket = RealSocket ,
91+ conn_name = ConnName ,
92+ parse_state = ParseState ,
93+ processor_state = ProcState ,
94+ heartbeat_sup = SupHelperPid ,
95+ heartbeat = {none , none },
96+ max_frame_size = MaxFrameSize ,
97+ current_frame_size = 0 ,
98+ state = running ,
99+ conserve_resources = false ,
100+ recv_outstanding = false })), # reader_state .stats_timer ),
101+ {backoff , 1000 , 1000 , 10000 });
102+ {error , enotconn } ->
103+ rabbit_net :fast_close (RealSocket ),
104+ terminate (shutdown , undefined );
68105 {error , Reason } ->
69- rabbit_log_connection :error (
70- " STOMP could not establish connection: ~s " , [Reason ]),
71- {stop , Reason };
72- {ok , Sock } ->
73- RealSocket = rabbit_net :unwrap_socket (Sock ),
74- case rabbit_net :connection_string (Sock , inbound ) of
75- {ok , ConnStr } ->
76- ConnName = rabbit_data_coercion :to_binary (ConnStr ),
77- ProcInitArgs = processor_args (Configuration , Sock ),
78- ProcState = rabbit_stomp_processor :initial_state (Configuration ,
79- ProcInitArgs ),
80-
81- rabbit_log_connection :info (" accepting STOMP connection ~tp (~ts )" ,
82- [self (), ConnName ]),
83-
84- ParseState = rabbit_stomp_frame :initial_state (),
85- _ = register_resource_alarm (),
86-
87- LoginTimeout = application :get_env (rabbitmq_stomp , login_timeout , 10_000 ),
88- MaxFrameSize = application :get_env (rabbitmq_stomp , max_frame_size , ? DEFAULT_MAX_FRAME_SIZE ),
89- erlang :send_after (LoginTimeout , self (), login_timeout ),
90-
91- gen_server2 :enter_loop (? MODULE , [],
92- rabbit_event :init_stats_timer (
93- run_socket (control_throttle (
94- # reader_state {socket = RealSocket ,
95- conn_name = ConnName ,
96- parse_state = ParseState ,
97- processor_state = ProcState ,
98- heartbeat_sup = SupHelperPid ,
99- heartbeat = {none , none },
100- max_frame_size = MaxFrameSize ,
101- current_frame_size = 0 ,
102- state = running ,
103- conserve_resources = false ,
104- recv_outstanding = false })), # reader_state .stats_timer ),
105- {backoff , 1000 , 1000 , 10000 });
106- {error , enotconn } ->
107- rabbit_net :fast_close (RealSocket ),
108- terminate (shutdown , undefined );
109- {error , Reason } ->
110- rabbit_net :fast_close (RealSocket ),
111- terminate ({network_error , Reason }, undefined )
112- end
106+ rabbit_net :fast_close (RealSocket ),
107+ terminate ({network_error , Reason }, undefined )
113108 end .
114109
110+
115111handle_call ({info , InfoItems }, _From , State ) ->
116112 Infos = lists :map (
117113 fun (InfoItem ) ->
0 commit comments