Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZEO
Commits
7201a417
Commit
7201a417
authored
Nov 19, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed an unused and untested module.
(Thanks to Patrick Strawderman for spotting a name error here.)
parent
fc146e02
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
90 deletions
+0
-90
src/ZEO/DebugServer.py
src/ZEO/DebugServer.py
+0
-90
No files found.
src/ZEO/DebugServer.py
deleted
100644 → 0
View file @
fc146e02
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
##############################################################################
"""A debugging version of the server that records network activity."""
import
struct
import
time
import
socket
from
ZEO.StorageServer
import
StorageServer
,
log
from
ZEO.zrpc.server
import
ManagedServerConnection
# a bunch of codes
NEW_CONN
=
1
CLOSE_CONN
=
2
DATA
=
3
ERROR
=
4
class
DebugManagedServerConnection
(
ManagedServerConnection
):
def
__init__
(
self
,
sock
,
addr
,
obj
,
mgr
):
# mgr is the DebugServer instance
self
.
mgr
=
mgr
self
.
__super_init
(
sock
,
addr
,
obj
)
record_id
=
mgr
.
_record_connection
(
addr
)
self
.
_record
=
lambda
code
,
data
:
mgr
.
_record
(
record_id
,
code
,
data
)
self
.
obj
.
notifyConnected
(
self
)
def
close
(
self
):
self
.
_record
(
CLOSE_CONN
,
""
)
ManagedServerConnection
.
close
(
self
)
# override the lowest-level of asyncore's connection
def
recv
(
self
,
buffer_size
):
try
:
data
=
self
.
socket
.
recv
(
buffer_size
)
if
not
data
:
# a closed connection is indicated by signaling
# a read condition, and having recv() return 0.
self
.
handle_close
()
return
''
else
:
self
.
_record
(
DATA
,
data
)
return
data
except
socket
.
error
,
why
:
# winsock sometimes throws ENOTCONN
self
.
_record
(
ERROR
,
why
)
if
why
[
0
]
in
[
ECONNRESET
,
ENOTCONN
,
ESHUTDOWN
]:
self
.
handle_close
()
return
''
else
:
raise
socket
.
error
(
why
)
class
DebugServer
(
StorageServer
):
ZEOStorageClass
=
DebugZEOStorage
ManagedServerConnectionClass
=
DebugManagerConnection
def
__init__
(
self
,
*
args
,
**
kwargs
):
StorageServer
.
__init__
(
*
args
,
**
kwargs
)
self
.
_setup_record
(
kwargs
[
"record"
])
self
.
_conn_counter
=
1
def
_setup_record
(
self
,
path
):
try
:
self
.
_recordfile
=
open
(
path
,
"ab"
)
except
IOError
,
msg
:
self
.
_recordfile
=
None
log
(
"failed to open recordfile %s: %s"
%
(
path
,
msg
))
def
_record_connection
(
self
,
addr
):
cid
=
self
.
_conn_counter
self
.
_conn_counter
+=
1
self
.
_record
(
cid
,
NEW_CONN
,
str
(
addr
))
return
cid
def
_record
(
self
,
conn
,
code
,
data
):
s
=
struct
.
pack
(
">iii"
,
code
,
time
.
time
(),
len
(
data
))
+
data
self
.
_recordfile
.
write
(
s
)
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