diff options
author | Anders Svensson <[email protected]> | 2015-03-24 11:03:23 +0100 |
---|---|---|
committer | Anders Svensson <[email protected]> | 2015-03-24 11:03:23 +0100 |
commit | 8cad0980fd09b36fe71ee91dd65e56fadb5a22b8 (patch) | |
tree | f3e587be5a8c16ee7f133bfd08f546c001d91cdc /lib/diameter/src/base/diameter_peer.erl | |
parent | 487446e76102b27fa8df02a353c7fdeec2d091f1 (diff) | |
parent | 79b86a035adb0068e544401104d4c04db8e2b181 (diff) | |
download | otp-8cad0980fd09b36fe71ee91dd65e56fadb5a22b8.tar.gz otp-8cad0980fd09b36fe71ee91dd65e56fadb5a22b8.tar.bz2 otp-8cad0980fd09b36fe71ee91dd65e56fadb5a22b8.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/diameter/src/base/diameter_peer.erl')
-rw-r--r-- | lib/diameter/src/base/diameter_peer.erl | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/diameter/src/base/diameter_peer.erl b/lib/diameter/src/base/diameter_peer.erl index ea326dd03e..89b63c8a92 100644 --- a/lib/diameter/src/base/diameter_peer.erl +++ b/lib/diameter/src/base/diameter_peer.erl @@ -232,12 +232,22 @@ recv(Pid, Pkt) -> %% # send/2 %% --------------------------------------------------------------------------- -send(Pid, #diameter_packet{transport_data = undefined, - bin = Bin}) -> - send(Pid, Bin); +send(Pid, Msg) -> + ifc_send(Pid, {send, strip(Msg)}). -send(Pid, Pkt) -> - ifc_send(Pid, {send, Pkt}). +%% Send only binary when possible. +strip(#diameter_packet{transport_data = undefined, + bin = Bin}) -> + Bin; + +%% Strip potentially large message terms. +strip(#diameter_packet{transport_data = T, + bin = Bin}) -> + #diameter_packet{transport_data = T, + bin = Bin}; + +strip(Msg) -> + Msg. %% --------------------------------------------------------------------------- %% # close/1 @@ -326,7 +336,6 @@ code_change(_OldVsn, State, _Extra) -> {ok, State}. %% --------------------------------------------------------- -%% INTERNAL FUNCTIONS %% --------------------------------------------------------- %% ifc_send/2 |