~clint-fewbar/ubuntu/precise/rabbitmq-server/fixed-upstream-tag

« back to all changes in this revision

Viewing changes to src/rabbit_networking.erl

  • Committer: Elliot Murphy
  • Date: 2010-11-30 15:12:51 UTC
  • mfrom: (0.2.9 upstream)
  • Revision ID: elliot@elliotmurphy.com-20101130151251-ziiiaf3kbomv3yse
Tags: 2.2.0-0ubuntu1
* New upstream release, fixes FTBFS for 2.1.1-1ubuntu1
  - fix issue that causes cross-cluster communication to
    deadlock after sustained cluster activity
  - fix queue memory leak when using the management plugin
    or other consumers of queue statistics
  - brokers started with rabbitmq_multi.bat are now restartable
  - clustering reset no longer destroys installed plugins
  - fix race condition between queue declaration and connection
    termination that causes spurious noproc errors to appear
    in the log
  - fix memory leak when long-running channels consume and
    cancel on many queues
  - queue.declare and exchange.declare raise precondition_failed
    rather than not_allowed when attempting to redeclare a queue
    or exchange with parameters different than those currently
    known to the broker
  - automatic, lossless upgrade to new versions of RabbitMQ
    (when not clustered)
  - support per-queue message TTL. See:
    http://www.rabbitmq.com/extensions.html#queue-ttl
  - the volume of pending acks is now bounded by disk space rather
    than by memory
  - store passwords as hashes
  - allow server properties to be configured in the RabbitMQ
    config file
  - SSL connections are listed as such by rabbitmqctl
  - simplify permission configuration by removing the client
    permission scope
  - improve performance of message routing
  - removed support for basic.recover with requeue=false
  - remove build-time dependency on OTP source to allow users to
    build without the OTP source present
  - eliminate all valid dialyzer errors

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
%%used by TCP-based transports, e.g. STOMP adapter
42
42
-export([check_tcp_listener_address/3]).
43
43
 
44
 
-export([tcp_listener_started/2, tcp_listener_stopped/2,
 
44
-export([tcp_listener_started/3, tcp_listener_stopped/3,
45
45
         start_client/1, start_ssl_client/2]).
46
46
 
47
47
-include("rabbit.hrl").
67
67
 
68
68
-spec(start/0 :: () -> 'ok').
69
69
-spec(start_tcp_listener/2 :: (hostname(), ip_port()) -> 'ok').
70
 
-spec(start_ssl_listener/3 :: (hostname(), ip_port(), [rabbit_types:info()])
 
70
-spec(start_ssl_listener/3 :: (hostname(), ip_port(), rabbit_types:infos())
71
71
                              -> 'ok').
72
72
-spec(stop_tcp_listener/2 :: (hostname(), ip_port()) -> 'ok').
73
73
-spec(active_listeners/0 :: () -> [rabbit_types:listener()]).
74
74
-spec(node_listeners/1 :: (node()) -> [rabbit_types:listener()]).
75
75
-spec(connections/0 :: () -> [rabbit_types:connection()]).
76
 
-spec(connection_info_keys/0 :: () -> [rabbit_types:info_key()]).
 
76
-spec(connection_info_keys/0 :: () -> rabbit_types:info_keys()).
77
77
-spec(connection_info/1 ::
78
 
        (rabbit_types:connection()) -> [rabbit_types:info()]).
 
78
        (rabbit_types:connection()) -> rabbit_types:infos()).
79
79
-spec(connection_info/2 ::
80
 
        (rabbit_types:connection(), [rabbit_types:info_key()])
81
 
        -> [rabbit_types:info()]).
82
 
-spec(connection_info_all/0 :: () -> [[rabbit_types:info()]]).
 
80
        (rabbit_types:connection(), rabbit_types:info_keys())
 
81
        -> rabbit_types:infos()).
 
82
-spec(connection_info_all/0 :: () -> [rabbit_types:infos()]).
83
83
-spec(connection_info_all/1 ::
84
 
        ([rabbit_types:info_key()]) -> [[rabbit_types:info()]]).
 
84
        (rabbit_types:info_keys()) -> [rabbit_types:infos()]).
85
85
-spec(close_connection/2 :: (pid(), string()) -> 'ok').
86
86
-spec(on_node_down/1 :: (node()) -> 'ok').
87
87
-spec(check_tcp_listener_address/3 ::
160
160
    {IPAddress, Name}.
161
161
 
162
162
start_tcp_listener(Host, Port) ->
163
 
    start_listener(Host, Port, "TCP Listener",
 
163
    start_listener(Host, Port, amqp, "TCP Listener",
164
164
                   {?MODULE, start_client, []}).
165
165
 
166
166
start_ssl_listener(Host, Port, SslOpts) ->
167
 
    start_listener(Host, Port, "SSL Listener",
 
167
    start_listener(Host, Port, 'amqp/ssl', "SSL Listener",
168
168
                   {?MODULE, start_ssl_client, [SslOpts]}).
169
169
 
170
 
start_listener(Host, Port, Label, OnConnect) ->
 
170
start_listener(Host, Port, Protocol, Label, OnConnect) ->
171
171
    {IPAddress, Name} =
172
172
        check_tcp_listener_address(rabbit_tcp_listener_sup, Host, Port),
173
173
    {ok,_} = supervisor:start_child(
175
175
               {Name,
176
176
                {tcp_listener_sup, start_link,
177
177
                 [IPAddress, Port, ?RABBIT_TCP_OPTS ,
178
 
                  {?MODULE, tcp_listener_started, []},
179
 
                  {?MODULE, tcp_listener_stopped, []},
 
178
                  {?MODULE, tcp_listener_started, [Protocol]},
 
179
                  {?MODULE, tcp_listener_stopped, [Protocol]},
180
180
                  OnConnect, Label]},
181
181
                transient, infinity, supervisor, [tcp_listener_sup]}),
182
182
    ok.
188
188
    ok = supervisor:delete_child(rabbit_sup, Name),
189
189
    ok.
190
190
 
191
 
tcp_listener_started(IPAddress, Port) ->
 
191
tcp_listener_started(Protocol, IPAddress, Port) ->
 
192
    %% We need the ip to distinguish e.g. 0.0.0.0 and 127.0.0.1
 
193
    %% We need the host so we can distinguish multiple instances of the above
 
194
    %% in a cluster.
192
195
    ok = mnesia:dirty_write(
193
196
           rabbit_listener,
194
197
           #listener{node = node(),
195
 
                     protocol = tcp,
 
198
                     protocol = Protocol,
196
199
                     host = tcp_host(IPAddress),
 
200
                     ip_address = IPAddress,
197
201
                     port = Port}).
198
202
 
199
 
tcp_listener_stopped(IPAddress, Port) ->
 
203
tcp_listener_stopped(Protocol, IPAddress, Port) ->
200
204
    ok = mnesia:dirty_delete_object(
201
205
           rabbit_listener,
202
206
           #listener{node = node(),
203
 
                     protocol = tcp,
 
207
                     protocol = Protocol,
204
208
                     host = tcp_host(IPAddress),
 
209
                     ip_address = IPAddress,
205
210
                     port = Port}).
206
211
 
207
212
active_listeners() ->