Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Updated to 2.8.2.

  • Loading branch information...
commit 4ac7947a515f670d146cc7475b231bca1f8bdbad 1 parent ce9d2b8
Jon Brisbin authored
8 amqp_client.sublime-project
... ... @@ -0,0 +1,8 @@
  1 +{
  2 + "folders":
  3 + [
  4 + {
  5 + "path": "/Users/jbrisbin/src/rabbitmq/amqp_client"
  6 + }
  7 + ]
  8 +}
138 amqp_client.sublime-workspace
... ... @@ -0,0 +1,138 @@
  1 +{
  2 + "auto_complete":
  3 + {
  4 + "selected_items":
  5 + [
  6 + ]
  7 + },
  8 + "buffers":
  9 + [
  10 + ],
  11 + "build_system": "",
  12 + "command_palette":
  13 + {
  14 + "height": 327.0,
  15 + "selected_items":
  16 + [
  17 + [
  18 + "Packa",
  19 + "Package Control: Install Package"
  20 + ]
  21 + ],
  22 + "width": 449.0
  23 + },
  24 + "console":
  25 + {
  26 + "height": 229.0
  27 + },
  28 + "distraction_free":
  29 + {
  30 + "menu_visible": true,
  31 + "show_minimap": false,
  32 + "show_open_files": false,
  33 + "show_tabs": false,
  34 + "side_bar_visible": false,
  35 + "status_bar_visible": false
  36 + },
  37 + "file_history":
  38 + [
  39 + "/Users/jbrisbin/Library/Application Support/Sublime Text 2/Packages/Default/Preferences.sublime-settings",
  40 + "/Users/jbrisbin/Library/Application Support/Sublime Text 2/Packages/User/Preferences.sublime-settings"
  41 + ],
  42 + "find":
  43 + {
  44 + "height": 0.0
  45 + },
  46 + "find_in_files":
  47 + {
  48 + "height": 0.0,
  49 + "where_history":
  50 + [
  51 + ]
  52 + },
  53 + "find_state":
  54 + {
  55 + "case_sensitive": false,
  56 + "find_history":
  57 + [
  58 + ],
  59 + "highlight": true,
  60 + "in_selection": false,
  61 + "preserve_case": false,
  62 + "regex": false,
  63 + "replace_history":
  64 + [
  65 + ],
  66 + "reverse": false,
  67 + "show_context": true,
  68 + "use_buffer2": true,
  69 + "whole_word": false,
  70 + "wrap": true
  71 + },
  72 + "groups":
  73 + [
  74 + {
  75 + "sheets":
  76 + [
  77 + ]
  78 + }
  79 + ],
  80 + "incremental_find":
  81 + {
  82 + "height": 0.0
  83 + },
  84 + "input":
  85 + {
  86 + "height": 0.0
  87 + },
  88 + "layout":
  89 + {
  90 + "cells":
  91 + [
  92 + [
  93 + 0,
  94 + 0,
  95 + 1,
  96 + 1
  97 + ]
  98 + ],
  99 + "cols":
  100 + [
  101 + 0.0,
  102 + 1.0
  103 + ],
  104 + "rows":
  105 + [
  106 + 0.0,
  107 + 1.0
  108 + ]
  109 + },
  110 + "menu_visible": true,
  111 + "replace":
  112 + {
  113 + "height": 0.0
  114 + },
  115 + "save_all_on_build": true,
  116 + "select_file":
  117 + {
  118 + "height": 0.0,
  119 + "selected_items":
  120 + [
  121 + ],
  122 + "width": 0.0
  123 + },
  124 + "select_project":
  125 + {
  126 + "height": 0.0,
  127 + "selected_items":
  128 + [
  129 + ],
  130 + "width": 0.0
  131 + },
  132 + "show_minimap": true,
  133 + "show_open_files": true,
  134 + "show_tabs": true,
  135 + "side_bar_visible": true,
  136 + "side_bar_width": 326.0,
  137 + "status_bar_visible": true
  138 +}
BIN  rebar
Binary file not shown
2  rebar.config
... ... @@ -1,5 +1,5 @@
1 1 {deps, [
2   - {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", {tag, "rabbitmq-2.8.1"}}}
  2 + {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", {tag, "rabbitmq-2.8.2"}}}
3 3 ]}.
4 4
5 5 {erl_opts, [
2  src/amqp_channel.erl
@@ -467,7 +467,7 @@ terminate(_Reason, State) ->
467 467
468 468 %% @private
469 469 code_change(_OldVsn, State, _Extra) ->
470   - State.
  470 + {ok, State}.
471 471
472 472 %%---------------------------------------------------------------------------
473 473 %% RPC mechanism
2  src/amqp_client.app.src
... ... @@ -1,6 +1,6 @@
1 1 {application, amqp_client,
2 2 [{description, "RabbitMQ Erlang Client Library"},
3   - {vsn, "2.8.1"},
  3 + {vsn, "2.8.2"},
4 4 {modules, []},
5 5 {registered, []},
6 6 {env, []},
37 src/amqp_main_reader.erl
@@ -44,9 +44,11 @@ start_link(Sock, Connection, ChMgr, AState) ->
44 44 %%---------------------------------------------------------------------------
45 45
46 46 init([Sock, Connection, ChMgr, AState]) ->
47   - {ok, _Ref} = rabbit_net:async_recv(Sock, 7, infinity),
48   - {ok, #state{sock = Sock, connection = Connection,
49   - channels_manager = ChMgr, astate = AState}}.
  47 + case next(7, #state{sock = Sock, connection = Connection,
  48 + channels_manager = ChMgr, astate = AState}) of
  49 + {noreply, State} -> {ok, State};
  50 + {stop, Reason, _State} -> {stop, Reason}
  51 + end.
50 52
51 53 terminate(_Reason, _State) ->
52 54 ok.
@@ -62,22 +64,14 @@ handle_cast(Cast, State) ->
62 64
63 65 handle_info({inet_async, Sock, _, {ok, <<Type:8, Channel:16, Length:32>>}},
64 66 State = #state{sock = Sock, message = none}) ->
65   - {ok, _Ref} = rabbit_net:async_recv(Sock, Length + 1, infinity),
66   - {noreply, State#state{message = {Type, Channel, Length}}};
  67 + next(Length + 1, State#state{message = {Type, Channel, Length}});
67 68 handle_info({inet_async, Sock, _, {ok, Data}},
68 69 State = #state{sock = Sock, message = {Type, Channel, L}}) ->
69 70 <<Payload:L/binary, ?FRAME_END>> = Data,
70   - State1 = process_frame(Type, Channel, Payload, State),
71   - {ok, _Ref} = rabbit_net:async_recv(Sock, 7, infinity),
72   - {noreply, State1#state{message = none}};
73   -handle_info({inet_async, Sock, _, {error, closed}},
74   - State = #state{sock = Sock, connection = Conn}) ->
75   - Conn ! socket_closed,
76   - {noreply, State};
  71 + next(7, process_frame(Type, Channel, Payload, State#state{message = none}));
77 72 handle_info({inet_async, Sock, _, {error, Reason}},
78   - State = #state{sock = Sock, connection = Conn}) ->
79   - Conn ! {socket_error, Reason},
80   - {stop, {socket_error, Reason}, State}.
  73 + State = #state{sock = Sock}) ->
  74 + handle_error(Reason, State).
81 75
82 76 %%---------------------------------------------------------------------------
83 77 %% Internal plumbing
@@ -104,3 +98,16 @@ process_frame(Type, ChNumber, Payload,
104 98 State#state{astate = amqp_channels_manager:process_channel_frame(
105 99 AnalyzedFrame, 0, Connection, AState)}
106 100 end.
  101 +
  102 +next(Length, State = #state{sock = Sock}) ->
  103 + case rabbit_net:async_recv(Sock, Length, infinity) of
  104 + {ok, _} -> {noreply, State};
  105 + {error, Reason} -> handle_error(Reason, State)
  106 + end.
  107 +
  108 +handle_error(closed, State = #state{connection = Conn}) ->
  109 + Conn ! socket_closed,
  110 + {noreply, State};
  111 +handle_error(Reason, State = #state{connection = Conn}) ->
  112 + Conn ! {socket_error, Reason},
  113 + {stop, {socket_error, Reason}, State}.

0 comments on commit 4ac7947

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