aboutsummaryrefslogtreecommitdiffstats
path: root/lib/eldap/src/eldap.erl
diff options
context:
space:
mode:
authorDaniil Fedotov <[email protected]>2016-05-03 13:28:09 +0100
committerDaniil Fedotov <[email protected]>2016-05-05 09:41:35 +0100
commit33b282356b786b831fe8f5414fa60397c4c7eaf9 (patch)
tree3a4dd0ad35248b88f8d26468c9e89ab83a83ec67 /lib/eldap/src/eldap.erl
parent6a1290f534164d1a5771dba37c23124652b9f7c9 (diff)
downloadotp-33b282356b786b831fe8f5414fa60397c4c7eaf9.tar.gz
otp-33b282356b786b831fe8f5414fa60397c4c7eaf9.tar.bz2
otp-33b282356b786b831fe8f5414fa60397c4c7eaf9.zip
Ignore tcp errors during close request to eldap
If underlying tcp connection is closed and LDAP operation returned tcp error, then client applications tend to close ldap handle with eldap:close. This will cause do_unbind to throw gen_tcp_error, which is unhandled and will be sent to linked process as {nocatch, {gen_tcp_error, ...}}. eldap should ignore gen_tcp_error during close, because it will be closing anyway.
Diffstat (limited to 'lib/eldap/src/eldap.erl')
-rw-r--r--lib/eldap/src/eldap.erl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/eldap/src/eldap.erl b/lib/eldap/src/eldap.erl
index dc236f8a44..8994df10eb 100644
--- a/lib/eldap/src/eldap.erl
+++ b/lib/eldap/src/eldap.erl
@@ -564,7 +564,12 @@ loop(Cpid, Data) ->
?MODULE:loop(Cpid, NewData);
{_From, close} ->
- {no_reply,_NewData} = do_unbind(Data),
+ % Ignore tcp error if connection is already closed.
+ try do_unbind(Data) of
+ {no_reply,_NewData} -> ok
+ catch
+ throw:{gen_tcp_error, _TcpErr} -> ok
+ end,
unlink(Cpid),
exit(closed);