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
322e1128
Commit
322e1128
authored
14 years ago
by
Antoine Millet
Browse files
Options
Downloads
Patches
Plain Diff
Calls now raise an exception if RpcConnection is disconnected from its peer.
parent
554b242b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sjrpc/core/rpcconnection.py
+8
-0
8 additions, 0 deletions
sjrpc/core/rpcconnection.py
with
8 additions
and
0 deletions
sjrpc/core/rpcconnection.py
+
8
−
0
View file @
322e1128
...
...
@@ -55,6 +55,9 @@ class RpcConnection(object):
# The manager of this connection
self
.
_manager
=
manager
# Is the RpcConnection connected to its peer:
self
.
_connected
=
True
@classmethod
def
from_addr
(
cls
,
addr
,
port
,
manager
,
enable_ssl
=
False
,
timeout
=
30.0
,
cert
=
None
,
handler
=
None
):
...
...
@@ -163,6 +166,9 @@ class RpcConnection(object):
Message must be a jsonisable structure.
'''
if
not
self
.
_connected
:
raise
RpcError
(
'
SendError
'
,
'
disconnected from the peer
'
)
logging
.
debug
(
'
Sending: %s
'
,
message
)
json_msg
=
json
.
dumps
(
message
)
size
=
struct
.
pack
(
'
!L
'
,
len
(
json_msg
))
...
...
@@ -373,6 +379,8 @@ class RpcConnection(object):
:type callback: :class:`str` or callable or None
'''
self
.
_connected
=
False
try
:
self
.
_sock
.
close
()
except
socket
.
error
as
err
:
...
...
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