Explorar el Código

fix(emqx_connection): do not log einval error

einval happens when trying to send data to a closed socket.
Zaiming Shi hace 4 años
padre
commit
dfab9492c6
Se han modificado 2 ficheros con 6 adiciones y 1 borrados
  1. 2 0
      src/emqx.appup.src
  2. 4 1
      src/emqx_connection.erl

+ 2 - 0
src/emqx.appup.src

@@ -2,6 +2,7 @@
 {VSN,
  [
    {"4.3.1", [
+     {load_module, emqx_connection, brutal_purge, soft_purge, []},
      {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_node_dump, brutal_purge, soft_purge, []}
    ]},
@@ -18,6 +19,7 @@
  ],
  [
    {"4.3.1", [
+     {load_module, emqx_connection, brutal_purge, soft_purge, []},
      {load_module, emqx_congestion, brutal_purge, soft_purge, []},
      {load_module, emqx_node_dump, brutal_purge, soft_purge, []}
    ]},

+ 4 - 1
src/emqx_connection.erl

@@ -683,7 +683,10 @@ handle_info(activate_socket, State = #state{sockstate = OldSst}) ->
     end;
 
 handle_info({sock_error, Reason}, State) ->
-    Reason =/= closed andalso ?LOG(error, "Socket error: ~p", [Reason]),
+    case Reason =/= closed andalso Reason =/= einval of
+        true -> ?LOG(warning, "socket_error: ~p", [Reason]);
+        false -> ok
+    end,
     handle_info({sock_closed, Reason}, close_socket(State));
 
 handle_info(Info, State) ->