Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sjrpc
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mirror
sjrpc
Commits
839a1ed2
Commit
839a1ed2
authored
12 years ago
by
Anael Beutot
Committed by
Anaël Beutot
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Handle accept in a loop and catch more errors on accept
parent
ef9aab1f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sjrpc/server/simple.py
+15
-12
15 additions, 12 deletions
sjrpc/server/simple.py
with
15 additions
and
12 deletions
sjrpc/server/simple.py
+
15
−
12
View file @
839a1ed2
...
...
@@ -70,18 +70,21 @@ class RpcServer(object):
def
_handle
(
self
,
watcher
,
revents
):
# Collect offline connections:
self
.
_collect_connection
()
try
:
sock
,
address
=
self
.
_sock
.
accept
()
except
socket
.
error
as
err
:
if
err
.
errno
in
self
.
NONBLOCKING_ERRORS
:
return
else
:
self
.
logger
.
warn
(
'
Error while accepting client: %s
'
,
err
)
return
self
.
logger
.
info
(
'
New incoming connection from %s:%s
'
,
*
address
)
conn
=
self
.
_wrap
(
sock
)
self
.
register
(
conn
)
while
True
:
try
:
sock
,
address
=
self
.
_sock
.
accept
()
except
socket
.
error
as
err
:
if
err
.
errno
in
self
.
NONBLOCKING_ERRORS
:
return
if
err
.
errno
in
(
errno
.
ECONNABORTED
,
errno
.
EPROTO
,
errno
.
EINTR
):
pass
else
:
self
.
logger
.
warn
(
'
Error while accepting client: %s
'
,
err
)
return
self
.
logger
.
info
(
'
New incoming connection from %s:%s
'
,
*
address
)
conn
=
self
.
_wrap
(
sock
)
self
.
register
(
conn
)
def
_collect_connection
(
self
):
"""
Collect the offlines connections.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment