25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

* src/tls/tls.erl: recv_data/2 doesn't throw exceptions now

* src/ejabberd_zlib/ejabberd_zlib.erl: Likewise

SVN Revision: 1217
This commit is contained in:
Alexey Shchepin 2008-03-03 11:55:19 +00:00
parent 993ffe9096
commit 76245f0fcf
3 changed files with 24 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2008-03-03 Alexey Shchepin <alexey@process-one.net>
* src/tls/tls.erl: recv_data/2 doesn't throw exceptions now
* src/ejabberd_zlib/ejabberd_zlib.erl: Likewise
2008-02-29 Alexey Shchepin <alexey@process-one.net>
* src/mod_roster.erl: Fixed "from" attribute in roster pushes

View File

@ -100,7 +100,7 @@ enable_zlib(SockMod, Socket) ->
end,
Port = open_port({spawn, ejabberd_zlib_drv}, [binary]),
{ok, #zlibsock{sockmod = SockMod, socket = Socket, zlibport = Port}}.
disable_zlib(#zlibsock{sockmod = SockMod, socket = Socket, zlibport = Port}) ->
port_close(Port),
{SockMod, Socket}.
@ -116,7 +116,15 @@ recv(#zlibsock{sockmod = SockMod, socket = Socket} = ZlibSock,
Error
end.
recv_data(#zlibsock{zlibport = Port} = _ZlibSock, Packet) ->
recv_data(ZlibSock, Packet) ->
case catch recv_data1(ZlibSock, Packet) of
{'EXIT', Reason} ->
{error, Reason};
Res ->
Res
end.
recv_data1(#zlibsock{zlibport = Port} = _ZlibSock, Packet) ->
case port_control(Port, ?INFLATE, Packet) of
<<0, In/binary>> ->
{ok, In};

View File

@ -149,7 +149,15 @@ recv(#tlssock{tcpsock = TCPSocket} = TLSSock,
Error
end.
recv_data(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
recv_data(TLSSock, Packet) ->
case catch recv_data1(TLSSock, Packet) of
{'EXIT', Reason} ->
{error, Reason};
Res ->
Res
end.
recv_data1(#tlssock{tcpsock = TCPSocket, tlsport = Port}, Packet) ->
case port_control(Port, ?SET_ENCRYPTED_INPUT, Packet) of
<<0>> ->
case port_control(Port, ?GET_DECRYPTED_INPUT, []) of