本文整理汇总了Python中errno.ECONNABORTED属性的典型用法代码示例。如果您正苦于以下问题:Python errno.ECONNABORTED属性的具体用法?Python errno.ECONNABORTED怎么用?Python errno.ECONNABORTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类errno
的用法示例。
在下文中一共展示了errno.ECONNABORTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def run(self):
#print(self.run, 'enter')
while True:
#print(self.run, 'cycle')
pollret = dict(self.pollobj.poll()).get(self.fileno, 0)
if pollret & POLLNVAL != 0:
break
if pollret & POLLIN == 0:
continue
try:
clientsock, addr = self.clicm.serversock.accept()
except Exception as why:
if isinstance(why, socket.error):
if why.errno == ECONNABORTED:
continue
elif why.errno == EBADF:
break
else:
raise
dump_exception('CLIConnectionManager: unhandled exception when accepting incoming connection')
break
#print(self.run, 'handle_accept')
ED2.callFromThread(self.clicm.handle_accept, clientsock, addr)
self.clicm = None
#print(self.run, 'exit')
示例2: create_url_loader
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def create_url_loader(
logger,
source_url: str,
format_name: str,
encoding: str,
type_hint_rules: Optional[TypeHintRules],
proxies: Optional[Dict],
) -> AbstractTableReader:
try:
return ptr.TableUrlLoader(
source_url,
format_name,
encoding=encoding,
type_hint_rules=type_hint_rules,
proxies=proxies,
)
except (ptr.HTTPError, ptr.UrlError) as e:
logger.error(msgfy.to_error_message(e))
sys.exit(ExitCode.FAILED_HTTP)
except ptr.ProxyError as e:
logger.error(msgfy.to_error_message(e))
sys.exit(errno.ECONNABORTED)
示例3: run_for_multiple
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def run_for_multiple(self, timeout):
while self.alive:
self.notify()
try:
ready = self.wait(timeout)
except StopWaiting:
return
if ready is not None:
for listener in ready:
if listener == self.PIPE[0]:
continue
try:
self.accept(listener)
except EnvironmentError as e:
if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
if not self.is_parent_alive():
return
示例4: request
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def request(self, host, handler, request_body, verbose=0):
#retry request once if cached connection has gone cold
for i in (0, 1):
try:
return self.single_request(host, handler, request_body, verbose)
except socket.error, e:
if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
raise
except httplib.BadStatusLine: #close after we sent request
if i:
raise
##
# Send a complete request, and parse the response.
#
# @param host Target host.
# @param handler Target PRC handler.
# @param request_body XML-RPC request body.
# @param verbose Debugging flag.
# @return Parsed response.
示例5: handle_accept
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def handle_accept(self):
try:
sock, addr = self.accept()
except TypeError:
# sometimes accept() might return None (see issue 91)
debug("call: handle_accept(); accept() returned None", self)
return
except socket.error as err:
# ECONNABORTED might be thrown on *BSD (see issue 105)
if err.errno != errno.ECONNABORTED:
raise
else:
debug("call: handle_accept(); accept() returned ECONNABORTED",
self)
else:
# sometimes addr == None instead of (ip, port) (see issue 104)
if addr is not None:
self.handle_accepted(sock, addr)
示例6: test_network_error_exception_detector
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def test_network_error_exception_detector(self):
http_error = HTTPError()
self.assertTrue(is_network_error(http_error))
location_value_error = LocationValueError()
self.assertTrue(is_network_error(location_value_error))
pool_error = PoolError(None, 'an error')
self.assertTrue(is_network_error(pool_error))
exception = Exception()
self.assertFalse(is_network_error(exception))
w3_conn_error = Web3ConnectionException()
self.assertFalse(is_network_error(w3_conn_error))
setattr(w3_conn_error, 'errno', errno.ECONNABORTED)
self.assertTrue(is_network_error(w3_conn_error))
setattr(w3_conn_error, 'errno', errno.EPERM)
self.assertFalse(is_network_error(w3_conn_error))
示例7: handle_accept
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def handle_accept(self):
try:
sock, addr = self.accept()
except TypeError:
# sometimes accept() might return None, see:
# https://github.com/giampaolo/pyftpdlib/issues/91
debug("call: handle_accept(); accept() returned None", self)
return
except socket.error as err:
# ECONNABORTED might be thrown on *BSD, see:
# https://github.com/giampaolo/pyftpdlib/issues/105
if err.errno != errno.ECONNABORTED:
raise
else:
debug("call: handle_accept(); accept() returned ECONNABORTED",
self)
else:
# sometimes addr == None instead of (ip, port) (see issue 104)
if addr is not None:
self.handle_accepted(sock, addr)
示例8: _do_tls_handshake
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def _do_tls_handshake(self):
try:
self.socket.do_handshake()
except ssl.SSLError as err:
if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
ssl.SSL_ERROR_WANT_WRITE):
return
elif err.args[0] == ssl.SSL_ERROR_EOF:
return self.handle_close()
raise
except OSError as err:
if err.args[0] == errno.ECONNABORTED:
return self.handle_close()
else:
self.tls_active = True
self.tls_starting = False
示例9: _handle_connection
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def _handle_connection(self, connection, address):
if self.ssl_options is not None:
assert ssl, "Python 2.6+ and OpenSSL required for SSL"
try:
connection = ssl.wrap_socket(connection,
server_side=True,
do_handshake_on_connect=False,
**self.ssl_options)
except ssl.SSLError, err:
if err.args[0] == ssl.SSL_ERROR_EOF:
return connection.close()
else:
raise
except socket.error, err:
if err.args[0] == errno.ECONNABORTED:
return connection.close()
else:
raise
示例10: run_for_multiple
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def run_for_multiple(self, timeout):
while self.alive:
self.notify()
try:
ready = self.wait(timeout)
except StopWaiting:
return
if ready is not None:
for listener in ready:
try:
self.accept(listener)
except socket.error as e:
if e.args[0] not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
if not self.is_parent_alive():
return
示例11: request
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def request(self, host, handler, request_body, verbose=False):
#retry request once if cached connection has gone cold
for i in (0, 1):
try:
return self.single_request(host, handler, request_body, verbose)
except socket.error as e:
if i or e.errno not in (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE):
raise
except http_client.BadStatusLine: #close after we sent request
if i:
raise
示例12: run_for_one
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def run_for_one(self, timeout):
listener = self.sockets[0]
while self.alive:
self.notify()
# Accept a connection. If we get an error telling us
# that no connection is waiting we fall down to the
# select which is where we'll wait for a bit for new
# workers to come give us some love.
try:
self.accept(listener)
# Keep processing clients until no one is waiting. This
# prevents the need to select() for every client that we
# process.
continue
except EnvironmentError as e:
if e.errno not in (errno.EAGAIN, errno.ECONNABORTED,
errno.EWOULDBLOCK):
raise
if not self.is_parent_alive():
return
try:
self.wait(timeout)
except StopWaiting:
return
示例13: accept
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def accept(self, server, listener):
try:
sock, client = listener.accept()
# initialize the connection object
conn = TConn(self.cfg, sock, client, server)
self.nr_conns += 1
# enqueue the job
self.enqueue_req(conn)
except EnvironmentError as e:
if e.errno not in (errno.EAGAIN,
errno.ECONNABORTED, errno.EWOULDBLOCK):
raise
示例14: test_handle_accept_other_socket_error
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def test_handle_accept_other_socket_error(self):
inst = self._makeOneWithMap()
eaborted = socket.error(errno.ECONNABORTED)
inst.socket = DummySock(toraise=eaborted)
inst.adj = DummyAdj
def foo():
raise socket.error
inst.accept = foo
inst.logger = DummyLogger()
inst.handle_accept()
self.assertEqual(inst.socket.accepted, False)
self.assertEqual(len(inst.logger.logged), 1)
示例15: _do_ssl_handshake
# 需要导入模块: import errno [as 别名]
# 或者: from errno import ECONNABORTED [as 别名]
def _do_ssl_handshake(self):
try:
self.socket.do_handshake()
except ssl.SSLError as err:
if err.args[0] in (ssl.SSL_ERROR_WANT_READ,
ssl.SSL_ERROR_WANT_WRITE):
return
elif err.args[0] == ssl.SSL_ERROR_EOF:
return self.handle_close()
raise
except socket.error as err:
if err.args[0] == errno.ECONNABORTED:
return self.handle_close()
else:
self._ssl_accepting = False