Skip to content
Browse files

Updated to 2.8.2.

  • Loading branch information...
1 parent ce9d2b8 commit 4ac7947a515f670d146cc7475b231bca1f8bdbad @jbrisbin committed Apr 30, 2012
Showing with 171 additions and 18 deletions.
  1. +8 −0 amqp_client.sublime-project
  2. +138 −0 amqp_client.sublime-workspace
  3. BIN rebar
  4. +1 −1 rebar.config
  5. +1 −1 src/amqp_channel.erl
  6. +1 −1 src/amqp_client.app.src
  7. +22 −15 src/amqp_main_reader.erl
View
8 amqp_client.sublime-project
@@ -0,0 +1,8 @@
+{
+ "folders":
+ [
+ {
+ "path": "/Users/jbrisbin/src/rabbitmq/amqp_client"
+ }
+ ]
+}
View
138 amqp_client.sublime-workspace
@@ -0,0 +1,138 @@
+{
+ "auto_complete":
+ {
+ "selected_items":
+ [
+ ]
+ },
+ "buffers":
+ [
+ ],
+ "build_system": "",
+ "command_palette":
+ {
+ "height": 327.0,
+ "selected_items":
+ [
+ [
+ "Packa",
+ "Package Control: Install Package"
+ ]
+ ],
+ "width": 449.0
+ },
+ "console":
+ {
+ "height": 229.0
+ },
+ "distraction_free":
+ {
+ "menu_visible": true,
+ "show_minimap": false,
+ "show_open_files": false,
+ "show_tabs": false,
+ "side_bar_visible": false,
+ "status_bar_visible": false
+ },
+ "file_history":
+ [
+ "/Users/jbrisbin/Library/Application Support/Sublime Text 2/Packages/Default/Preferences.sublime-settings",
+ "/Users/jbrisbin/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings"
+ ],
+ "find":
+ {
+ "height": 0.0
+ },
+ "find_in_files":
+ {
+ "height": 0.0,
+ "where_history":
+ [
+ ]
+ },
+ "find_state":
+ {
+ "case_sensitive": false,
+ "find_history":
+ [
+ ],
+ "highlight": true,
+ "in_selection": false,
+ "preserve_case": false,
+ "regex": false,
+ "replace_history":
+ [
+ ],
+ "reverse": false,
+ "show_context": true,
+ "use_buffer2": true,
+ "whole_word": false,
+ "wrap": true
+ },
+ "groups":
+ [
+ {
+ "sheets":
+ [
+ ]
+ }
+ ],
+ "incremental_find":
+ {
+ "height": 0.0
+ },
+ "input":
+ {
+ "height": 0.0
+ },
+ "layout":
+ {
+ "cells":
+ [
+ [
+ 0,
+ 0,
+ 1,
+ 1
+ ]
+ ],
+ "cols":
+ [
+ 0.0,
+ 1.0
+ ],
+ "rows":
+ [
+ 0.0,
+ 1.0
+ ]
+ },
+ "menu_visible": true,
+ "replace":
+ {
+ "height": 0.0
+ },
+ "save_all_on_build": true,
+ "select_file":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "select_project":
+ {
+ "height": 0.0,
+ "selected_items":
+ [
+ ],
+ "width": 0.0
+ },
+ "show_minimap": true,
+ "show_open_files": true,
+ "show_tabs": true,
+ "side_bar_visible": true,
+ "side_bar_width": 326.0,
+ "status_bar_visible": true
+}
View
BIN rebar
Binary file not shown.
View
2 rebar.config
@@ -1,5 +1,5 @@
{deps, [
- {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", {tag, "rabbitmq-2.8.1"}}}
+ {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", {tag, "rabbitmq-2.8.2"}}}
]}.
{erl_opts, [
View
2 src/amqp_channel.erl
@@ -467,7 +467,7 @@ terminate(_Reason, State) ->
%% @private
code_change(_OldVsn, State, _Extra) ->
- State.
+ {ok, State}.
%%---------------------------------------------------------------------------
%% RPC mechanism
View
2 src/amqp_client.app.src
@@ -1,6 +1,6 @@
{application, amqp_client,
[{description, "RabbitMQ Erlang Client Library"},
- {vsn, "2.8.1"},
+ {vsn, "2.8.2"},
{modules, []},
{registered, []},
{env, []},
View
37 src/amqp_main_reader.erl
@@ -44,9 +44,11 @@ start_link(Sock, Connection, ChMgr, AState) ->
%%---------------------------------------------------------------------------
init([Sock, Connection, ChMgr, AState]) ->
- {ok, _Ref} = rabbit_net:async_recv(Sock, 7, infinity),
- {ok, #state{sock = Sock, connection = Connection,
- channels_manager = ChMgr, astate = AState}}.
+ case next(7, #state{sock = Sock, connection = Connection,
+ channels_manager = ChMgr, astate = AState}) of
+ {noreply, State} -> {ok, State};
+ {stop, Reason, _State} -> {stop, Reason}
+ end.
terminate(_Reason, _State) ->
ok.
@@ -62,22 +64,14 @@ handle_cast(Cast, State) ->
handle_info({inet_async, Sock, _, {ok, <<Type:8, Channel:16, Length:32>>}},
State = #state{sock = Sock, message = none}) ->
- {ok, _Ref} = rabbit_net:async_recv(Sock, Length + 1, infinity),
- {noreply, State#state{message = {Type, Channel, Length}}};
+ next(Length + 1, State#state{message = {Type, Channel, Length}});
handle_info({inet_async, Sock, _, {ok, Data}},
State = #state{sock = Sock, message = {Type, Channel, L}}) ->
<<Payload:L/binary, ?FRAME_END>> = Data,
- State1 = process_frame(Type, Channel, Payload, State),
- {ok, _Ref} = rabbit_net:async_recv(Sock, 7, infinity),
- {noreply, State1#state{message = none}};
-handle_info({inet_async, Sock, _, {error, closed}},
- State = #state{sock = Sock, connection = Conn}) ->
- Conn ! socket_closed,
- {noreply, State};
+ next(7, process_frame(Type, Channel, Payload, State#state{message = none}));
handle_info({inet_async, Sock, _, {error, Reason}},
- State = #state{sock = Sock, connection = Conn}) ->
- Conn ! {socket_error, Reason},
- {stop, {socket_error, Reason}, State}.
+ State = #state{sock = Sock}) ->
+ handle_error(Reason, State).
%%---------------------------------------------------------------------------
%% Internal plumbing
@@ -104,3 +98,16 @@ process_frame(Type, ChNumber, Payload,
State#state{astate = amqp_channels_manager:process_channel_frame(
AnalyzedFrame, 0, Connection, AState)}
end.
+
+next(Length, State = #state{sock = Sock}) ->
+ case rabbit_net:async_recv(Sock, Length, infinity) of
+ {ok, _} -> {noreply, State};
+ {error, Reason} -> handle_error(Reason, State)
+ end.
+
+handle_error(closed, State = #state{connection = Conn}) ->
+ Conn ! socket_closed,
+ {noreply, State};
+handle_error(Reason, State = #state{connection = Conn}) ->
+ Conn ! {socket_error, Reason},
+ {stop, {socket_error, Reason}, State}.

0 comments on commit 4ac7947

Please sign in to comment.
Something went wrong with that request. Please try again.