Skip to content

Commit d60d5c3

Browse files
committed
Merge pull request #363 from jonnytpuppet/tcp_listen_options_fix
MODULES-1871 - Added default values to tcp_listen_options
2 parents 067d25e + e8e3f55 commit d60d5c3

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

spec/classes/rabbitmq_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,14 +923,14 @@
923923
let(:params) {{ :tcp_keepalive => true }}
924924
it 'should set tcp_listen_options keepalive true' do
925925
should contain_file('rabbitmq.config') \
926-
.with_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
926+
.with_content(/\{keepalive, true\}/)
927927
end
928928
end
929929

930930
describe 'tcp_keepalive disabled (default)' do
931931
it 'should not set tcp_listen_options' do
932932
should contain_file('rabbitmq.config') \
933-
.without_content(/\{tcp_listen_options, \[\{keepalive, true\}\]\},/)
933+
.without_content(/\{keepalive, true\}/)
934934
end
935935
end
936936

templates/rabbitmq.config.erb

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@
1212
{cluster_nodes, {[<%= @cluster_nodes.map { |n| "\'rabbit@#{n}\'" }.join(', ') %>], <%= @cluster_node_type %>}},
1313
{cluster_partition_handling, <%= @cluster_partition_handling %>},
1414
<% end -%>
15-
<%- if @tcp_keepalive -%>
16-
{tcp_listen_options, [{keepalive, true}]},
17-
<%- end -%>
15+
{tcp_listen_options,
16+
[binary,
17+
<%- if @tcp_keepalive -%>
18+
{keepalive, true},
19+
<%- end -%>
20+
{packet, raw},
21+
{reuseaddr, true},
22+
{backlog, 128},
23+
{nodelay, true},
24+
{exit_on_close, false}]
25+
},
1826
<%- if @ssl_only -%>
1927
{tcp_listeners, []},
2028
<%- elsif @interface != 'UNSET' -%>

0 commit comments

Comments
 (0)