This is an automated email from the ASF dual-hosted git repository.

dlive pushed a commit to branch 0.4.0
in repository https://gitbox.apache.org/repos/asf/dubbo-erlang.git


The following commit(s) were added to refs/heads/0.4.0 by this push:
     new b3be26f  optimize code style
b3be26f is described below

commit b3be26f770e8d50706f7edca1cc4ccb8551ca8bc
Author: DLive <[email protected]>
AuthorDate: Thu Jul 25 15:36:16 2019 +0800

    optimize code style
---
 rebar.config                  |  2 --
 src/dubbo_client_default.erl  | 17 ++++-------------
 src/dubbo_common_fun.erl      |  3 ---
 src/dubbo_extension.erl       |  1 -
 src/dubbo_protocol.erl        |  4 ++--
 src/dubbo_shutdown.erl        |  1 -
 src/dubbo_traffic_control.erl |  1 -
 src/dubbo_type_decoding.erl   |  2 --
 src/dubbo_type_register.erl   |  1 -
 9 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/rebar.config b/rebar.config
index f7d51b9..280a1c3 100644
--- a/rebar.config
+++ b/rebar.config
@@ -2,8 +2,6 @@
 
 {lib_dirs, []}.
 {base_dir, "_build"}.
-{root_dir, "."}.
-{project_app_dirs, ["."]}.
 
 {plugins, [
        rebar3_hex
diff --git a/src/dubbo_client_default.erl b/src/dubbo_client_default.erl
index 3fe08fa..7a4e6a4 100644
--- a/src/dubbo_client_default.erl
+++ b/src/dubbo_client_default.erl
@@ -156,15 +156,13 @@ handle_cast(_Request, State) ->
 
 
 handle_info({tcp, _Port, Data}, #state{recv_buffer = RecvBuffer} = State) ->
-%%    inet:setopts(State#state.socket, [{active, once}]),
-%%    logger:debug("[INFO] recv one data ~w",[Data]),
     {ok, NextBuffer, NewState} = case check_recv_data(<<RecvBuffer/binary, 
Data/binary>>, State) of
                                      {next_buffer, NextBuffer2, State3} ->
                                          logger:debug("recv one data state 
wait next_buffer"),
                                          {ok, NextBuffer2, State3}
                                  end,
-%%    HeartbeatInfo =update_heartbeat(write,NewState#state.heartbeat),
-    {noreply, NewState#state{recv_buffer = NextBuffer}};
+    HeartbeatInfo = update_heartbeat(read, NewState#state.heartbeat),
+    {noreply, NewState#state{recv_buffer = NextBuffer, heartbeat = 
HeartbeatInfo}};
 handle_info({tcp_closed, Port}, State) ->
     logger:info("dubbo connection closed ~p", [Port]),
     NewState = reconnect(State),
@@ -186,12 +184,6 @@ handle_info({timeout, _TimerRef, {heartbeat_timer}}, 
State) ->
     {noreply, NewState#state{heartbeat = HeartbeatInfo}};
 handle_info(_Info, State) ->
     logger:warning("[INFO] get one info:~p", [_Info]),
-%%    inet:setopts(State#state.socket, [{active, once}]),
-%%    case State#state.tmp_pid of
-%%        undefined  ->ok;
-%%        Pid ->
-%%            gen_server:cast(Pid,{msg_back})
-%%    end,
     HeartbeatInfo = update_heartbeat(write, State#state.heartbeat),
     {noreply, State#state{heartbeat = HeartbeatInfo}}.
 
@@ -328,7 +320,7 @@ send_heartbeat_msg(Mid, NeedResponse, State) ->
     {ok, NewState}.
 
 %%%=================================================================
-%%% 接收数据处理
+%%% receive data process
 %%%=================================================================
 -spec check_recv_data(Data :: binary(), State :: #state{}) -> {ready, 
ReadyData :: binary()} | {ready, ReadyData :: binary(), NextBuffer :: binary()}.
 check_recv_data(<<?DUBBO_MEGIC_HIGH, ?DUBBO_MEGIC_LOW, Rest/binary>> = Data, 
State) when byte_size(Rest) < 14 ->
@@ -346,7 +338,6 @@ check_recv_data(<<?DUBBO_MEGIC_HIGH, ?DUBBO_MEGIC_LOW, 
_OtherFlag:80, DataLen:32
             <<ReadyData:DataLen/binary, NextBuffer/binary>> = Rest,
             OneData = <<?DUBBO_MEGIC_HIGH:8, ?DUBBO_MEGIC_LOW:8, 
_OtherFlag:80, DataLen:32, ReadyData/binary>>,
             {ok, State3} = process_data(OneData, State),
-%%            logger:warning("recevi more data ~w ",[NextBuffer]),
             check_recv_data(NextBuffer, State3)
     end;
 check_recv_data(<<Error/integer, Data/binary>>, State) ->
@@ -361,7 +352,7 @@ process_data(Data, #state{handler = ProtocolHandle} = 
State) ->
         ok ->
             ok;
         {do_heartbeat, Mid} ->
-            send_heartbeat_msg(Mid, false,State),
+            send_heartbeat_msg(Mid, false, State),
             ok
     end,
     {ok, State}.
diff --git a/src/dubbo_common_fun.erl b/src/dubbo_common_fun.erl
index b68ad99..ad15be1 100644
--- a/src/dubbo_common_fun.erl
+++ b/src/dubbo_common_fun.erl
@@ -93,13 +93,10 @@ url_to_binary(UrlInfo) ->
         ])),
     list_to_binary(Value).
 format_path(<< ?URL_PATH_SEPARATOR:8,Rest/binary>>) ->
-    logger:debug("format_path1 ~p",[Rest]),
     Rest;
 format_path([?URL_PATH_SEPARATOR|Rest]) ->
-    logger:debug("format_path3 ~p",[Rest]),
     Rest;
 format_path(Value) ->
-    logger:debug("format_path2 ~p",[Value]),
     Value.
 
 format_parameter(undefined) ->
diff --git a/src/dubbo_extension.erl b/src/dubbo_extension.erl
index 75db250..e6f4394 100644
--- a/src/dubbo_extension.erl
+++ b/src/dubbo_extension.erl
@@ -53,7 +53,6 @@ run1([M | Rest], HookName, Fun, Args) ->
     Ret = (catch apply(M, Fun, Args)),
     case Ret of
         {'EXIT', Reason} ->
-            io:format(user, "~p~n error running extension: ~p~n", [HookName, 
Reason]),
             logger:error("~p~n error running extension: ~p~n", [HookName, 
Reason]),
             run1(Rest, HookName, Fun, Args);
         stop ->
diff --git a/src/dubbo_protocol.erl b/src/dubbo_protocol.erl
index 4af3ea5..02452bd 100644
--- a/src/dubbo_protocol.erl
+++ b/src/dubbo_protocol.erl
@@ -18,6 +18,6 @@
 
 -include("dubbo.hrl").
 
--callback refer(Url :: binary(), Acc :: term()) -> {ok,Acc}.
+-callback refer(Url :: binary(), Acc :: term()) -> {ok, Acc :: term()}.
 
--callback export(Invoker :: #invoker{}, Acc :: term()) -> {ok,Acc}.
+-callback export(Invoker :: #invoker{}, Acc :: term()) -> {ok, Acc :: term()}.
diff --git a/src/dubbo_shutdown.erl b/src/dubbo_shutdown.erl
index 856bd41..052b4b7 100644
--- a/src/dubbo_shutdown.erl
+++ b/src/dubbo_shutdown.erl
@@ -68,7 +68,6 @@ start_link() ->
     {stop, Reason :: term()} | ignore).
 init([]) ->
     process_flag(trap_exit, true),
-    io:format("start shutdown ser"),
     {ok, #state{}}.
 
 %%--------------------------------------------------------------------
diff --git a/src/dubbo_traffic_control.erl b/src/dubbo_traffic_control.erl
index 853ce82..6fadae5 100644
--- a/src/dubbo_traffic_control.erl
+++ b/src/dubbo_traffic_control.erl
@@ -23,7 +23,6 @@
 init() ->
     case ets:info(?TRAFFIC_CONTROL) of
         undefined ->
-            io:format("init decoding TRAFFIC_CONTROL table pid ~p~n", 
[self()]),
             ets:new(?TRAFFIC_CONTROL, [public, named_table, 
{write_concurrency, true}]); %% public
         _ ->
             ets:delete(?TRAFFIC_CONTROL),
diff --git a/src/dubbo_type_decoding.erl b/src/dubbo_type_decoding.erl
index 7dd95e0..a861855 100644
--- a/src/dubbo_type_decoding.erl
+++ b/src/dubbo_type_decoding.erl
@@ -186,7 +186,6 @@ init(Delete) when is_boolean(Delete) ->
 %%    end,
     case ets:info(?TYPEPOOL_TABLE) of
         undefined ->
-            io:format("init decoding type_pool table pid ~p~n", [self()]),
             ets:new(?TYPEPOOL_TABLE, [public, named_table]); %% public
         _ ->
 %%            io:format("type decoding etsinfo ~p~n",[EtsInfo]),
@@ -200,7 +199,6 @@ init(Delete) when is_boolean(Delete) ->
     end,
     case ets:info(?REFERENCEPOOL_TABLE) of
         undefined ->
-            io:format("init decoding REFERENCEPOOL_TABLE table pid ~p~n", 
[self()]),
             ets:new(?REFERENCEPOOL_TABLE, [public, named_table]); %% public
         _ ->
             if
diff --git a/src/dubbo_type_register.erl b/src/dubbo_type_register.erl
index 4962c2c..d2b41fd 100644
--- a/src/dubbo_type_register.erl
+++ b/src/dubbo_type_register.erl
@@ -32,7 +32,6 @@ init() ->
     end,
     case ets:info(?NATIVE_FOREIGN_TABLE) of
         undefined ->
-            io:format("init decoding native_foreign_table table pid ~p~n", 
[self()]),
             ?NATIVE_FOREIGN_TABLE = ets:new(?NATIVE_FOREIGN_TABLE, [public, 
named_table]); %% public
         _ ->
             ets:delete(?NATIVE_FOREIGN_TABLE),

Reply via email to