diff options
author | Loïc Hoguin <[email protected]> | 2014-03-21 10:49:44 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2014-03-21 10:49:44 +0100 |
commit | 9c662615ace7e8b9c075e8a6a1752d849276b13d (patch) | |
tree | 56892801ac12d9d8116d59c09acc5fa82770ca85 /src/gun.erl | |
parent | 11dfe71f4b9aedaaedea2ad3b2f32fd006a8480f (diff) | |
download | gun-9c662615ace7e8b9c075e8a6a1752d849276b13d.tar.gz gun-9c662615ace7e8b9c075e8a6a1752d849276b13d.tar.bz2 gun-9c662615ace7e8b9c075e8a6a1752d849276b13d.zip |
Add a debug function to send raw data
Diffstat (limited to 'src/gun.erl')
-rw-r--r-- | src/gun.erl | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/gun.erl b/src/gun.erl index 978e550..16aa6a4 100644 --- a/src/gun.erl +++ b/src/gun.erl @@ -49,6 +49,9 @@ -export([ws_upgrade/3]). -export([ws_send/2]). +%% Debug. +-export([dbg_send_raw/2]). + %% Internals. -export([start_link/4]). -export([init/5]). @@ -226,6 +229,13 @@ ws_send(ServerPid, Frames) -> _ = ServerPid ! {ws_send, self(), Frames}, ok. +%% Debug. + +-spec dbg_send_raw(pid(), iodata()) -> ok. +dbg_send_raw(ServerPid, Data) -> + _ = ServerPid ! {dbg_send_raw, self(), Data}, + ok. + %% Internals. start_link(Owner, Host, Port, Opts) -> @@ -358,6 +368,9 @@ loop(State=#state{parent=Parent, owner=Owner, host=Host, {system, From, Request} -> sys:handle_system_msg(Request, From, Parent, ?MODULE, [], {loop, State}); + {dbg_send_raw, Owner, Data} -> + Transport:send(Socket, Data), + loop(State); Any when is_tuple(Any), is_pid(element(2, Any)) -> element(2, Any) ! {gun_error, self(), {notowner, "Operations are restricted to the owner of the connection."}}, |