Skip to content

Commit

Permalink
UPgrade to inert v0.6.2: fix compilation on GCC 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean Parpaillon committed Jun 17, 2016
1 parent b3c8339 commit 56b3904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEPS = inert procket edown
#DEP_PLUGINS = annotations

dep_procket = git https://github.com/msantos/procket.git master
dep_inert = git https://github.com/msantos/inert.git 0.2.1
dep_inert = git https://github.com/msantos/inert.git 0.6.2
dep_annotations_commit = 9f8a800

EDOC_OPTS = {app_default, "http://www.erlang.org/doc/"} \
Expand Down
14 changes: 7 additions & 7 deletions src/dbus_transport_unix.erl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
terminate/2]).

%% Internal
-export([do_read/3]).
-export([do_read/2]).

-record(state, {sock,
owner,
Expand All @@ -53,14 +53,14 @@ connect(BusOptions, _Options) ->
init([{Mode, Path}, Owner]) when is_pid(Owner), is_binary(Path) ->
true = link(Owner),
?debug("Connecting to UNIX socket: ~p~n", [Path]),
ok = inert:start(),
case procket:socket(?PF_LOCAL, ?SOCK_STREAM, 0) of
{ok, Sock} ->
SockUn = get_sock_un(Mode, Path),
case procket:connect(Sock, SockUn) of
ok ->
process_flag(trap_exit, true),
PollID = inert:start(),
Loop = spawn_link(?MODULE, do_read, [PollID, Sock, self()]),
Loop = spawn_link(?MODULE, do_read, [Sock, self()]),
{ok, #state{sock=Sock, owner=Owner, loop=Loop}};
{error, Err} ->
?error("Error connecting socket: ~p~n", [Err]),
Expand Down Expand Up @@ -136,19 +136,19 @@ terminate(_Reason, #state{sock=Sock, loop=Loop}) ->
%%%
%%% Priv
%%%
do_read(PollID, Sock, Pid) ->
do_read(Sock, Pid) ->
case procket:recvfrom(Sock, 16#FFFF) of
{error, eagain} ->
ok = inert:poll(PollID, Sock),
do_read(PollID, Sock, Pid);
{ok, read} = inert:poll(Sock, [{mode, read}]),
do_read(Sock, Pid);
{error, _Err} ->
ok;
%% EOF
{ok, <<>>} ->
ok;
{ok, Buf} ->
Pid ! {unix, Buf},
do_read(PollID, Sock, Pid)
do_read(Sock, Pid)
end.

get_sock_un(abstract, Path) when byte_size(Path) < ?UNIX_PATH_MAX-1 ->
Expand Down

0 comments on commit 56b3904

Please sign in to comment.