FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add retry on EINTR. by rgbyrnes · Pull Request #291 · python-ldap/python-ldap · GitHub

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 17 additions & 1 deletion Lib/ldap/ldapobject.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,22 @@

from ldap import LDAPError

from errno import EINTR

def _retry_if_interrupted(func, *args, **kwargs):
"""Call func, retrying if it raises an LDAPError with errno == EINTR.
"""

while True:
try:
return func(*args, **kwargs)
except LDAPError as e:
try:
if e.args[0]['errno'] != EINTR:
raise
except (AttributeError, IndexError, KeyError):
raise e

PY2 = sys.version_info[0] <= 2
if PY2:
text_type = unicode
Expand Down Expand Up @@ -312,7 +328,7 @@ def _ldap_call(self,func,*args,**kwargs):
diagnostic_message_success = None
try:
try:
result = func(*args,**kwargs)
result = _retry_if_interrupted(func, *args, **kwargs)
if __debug__ and self._trace_level>=2:
if func.__name__!="unbind_ext":
diagnostic_message_success = self._l.get_option(ldap.OPT_DIAGNOSTIC_MESSAGE)
Expand Down

Back | FazBrowse Home | New Git URL