Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sjrpc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Mirror
sjrpc
Commits
82707818
Commit
82707818
authored
Feb 07, 2011
by
Antoine Millet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed logging calls with format string.
parent
8d93a63f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
sjrpc/client/simple.py
sjrpc/client/simple.py
+3
-3
sjrpc/core/rpcconnection.py
sjrpc/core/rpcconnection.py
+5
-5
sjrpc/server/simple.py
sjrpc/server/simple.py
+6
-6
No files found.
sjrpc/client/simple.py
View file @
82707818
...
...
@@ -84,7 +84,7 @@ class SimpleRpcClient(ConnectionManager):
self
.
_connection
.
receive
()
except
socket
.
error
as
err
:
logging
.
error
(
'Socket error while receiving from the client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown
()
if
event
&
select
.
EPOLLOUT
:
...
...
@@ -93,11 +93,11 @@ class SimpleRpcClient(ConnectionManager):
self
.
_connection
.
send
()
except
socket
.
error
as
err
:
logging
.
error
(
'Socket error while sending to the client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown
()
if
event
&
select
.
EPOLLHUP
:
logging
.
error
(
'Socket HUP fd/%s'
%
fd
)
logging
.
error
(
'Socket HUP fd/%s'
,
fd
)
self
.
shutdown
()
#TODO
def
all_connections
(
self
):
...
...
sjrpc/core/rpcconnection.py
View file @
82707818
...
...
@@ -149,7 +149,7 @@ class RpcConnection(object):
payload
=
self
.
_inbound_buffer
.
pull
(
self
.
_cur_msg_size
)
self
.
_cur_msg_size
=
None
message
=
json
.
loads
(
payload
)
logging
.
debug
(
'Received: %s'
%
message
)
logging
.
debug
(
'Received: %s'
,
message
)
self
.
dispatch
(
message
)
return
True
...
...
@@ -164,7 +164,7 @@ class RpcConnection(object):
Message must be a jsonisable structure.
'''
logging
.
debug
(
'Sending: %s'
%
message
)
logging
.
debug
(
'Sending: %s'
,
message
)
json_msg
=
json
.
dumps
(
message
)
size
=
struct
.
pack
(
'!L'
,
len
(
json_msg
))
with
self
.
_outbound_buffer
:
...
...
@@ -224,7 +224,7 @@ class RpcConnection(object):
self
.
_send_response
(
msg_id
,
returned
=
returned
)
def
error
(
self
,
msg_id
,
error
,
message
):
def
error
(
self
,
msg_id
,
error
,
message
,
traceback
=
None
):
'''
Send an error response to the peer.
...
...
@@ -363,7 +363,7 @@ class RpcConnection(object):
# manager while cleanup.
else
:
logging
.
warning
(
'Malformed message received: %s'
%
message
)
logging
.
warning
(
'Malformed message received: %s'
,
message
)
def
shutdown
(
self
,
callback
=
None
):
'''
...
...
@@ -401,7 +401,7 @@ class RpcConnection(object):
callback
(
self
)
except
Exception
as
err
:
logging
.
error
(
'Error while execution of shutdown '
'callback: %s'
%
err
)
'callback: %s'
,
err
)
def
clean_call
(
self
,
msg_id
):
'''
...
...
sjrpc/server/simple.py
View file @
82707818
...
...
@@ -79,11 +79,11 @@ class SimpleRpcServer(ConnectionManager):
connection
.
receive
()
except
socket
.
error
as
err
:
logging
.
error
(
'Socket error while receiving from client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown_client
(
fd
)
except
Exception
as
err
:
logging
.
error
(
'Unknown error while receiving from client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown_client
(
fd
)
if
event
&
select
.
EPOLLOUT
:
...
...
@@ -92,15 +92,15 @@ class SimpleRpcServer(ConnectionManager):
connection
.
send
()
except
socket
.
error
as
err
:
logging
.
error
(
'Socket error while sending to the client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown_client
(
fd
)
except
Exception
as
err
:
logging
.
error
(
'Unknown error while sending to the client '
'fd/%s: %s'
%
(
fd
,
err
)
)
'fd/%s: %s'
,
fd
,
err
)
self
.
shutdown_client
(
fd
)
if
event
&
select
.
EPOLLHUP
:
logging
.
error
(
'Socket HUP fd/%s'
%
fd
)
logging
.
error
(
'Socket HUP fd/%s'
,
fd
)
self
.
shutdown_client
(
fd
)
...
...
@@ -129,6 +129,6 @@ class SimpleSslRpcServer(SimpleRpcServer):
ssl_version
=
ssl
.
PROTOCOL_TLSv1
,
do_handshake_on_connect
=
True
)
except
ssl
.
SSLError
as
err
:
logging
.
error
(
'Error when accepting ssl connection: %s'
%
err
)
logging
.
error
(
'Error when accepting ssl connection: %s'
,
err
)
else
:
return
sslsock
,
address
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment