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
2bf1da0f
Commit
2bf1da0f
authored
May 08, 2001
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new features from ZEO2.
Support for using basic multi framework with other run() functions.
parent
0017bbdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
10 deletions
+7
-10
src/ZEO/tests/multi.py
src/ZEO/tests/multi.py
+7
-10
No files found.
src/ZEO/tests/multi.py
View file @
2bf1da0f
...
...
@@ -53,14 +53,17 @@ def start_server(addr):
pid
,
exit
=
forker
.
start_zeo_server
(
storage
,
addr
)
return
pid
,
exit
def
start_client
(
addr
):
def
start_client
(
addr
,
client_func
=
None
):
pid
=
os
.
fork
()
if
pid
==
0
:
import
ZEO.ClientStorage
if
VERBOSE
:
print
"Client process started:"
,
os
.
getpid
()
cli
=
ZEO
.
ClientStorage
.
ClientStorage
(
addr
,
client
=
CLIENT_CACHE
)
run
(
cli
)
if
client_func
is
None
:
run
(
cli
)
else
:
client_func
(
cli
)
cli
.
close
()
os
.
_exit
(
0
)
else
:
...
...
@@ -106,20 +109,14 @@ def run(storage):
print
"Client completed:"
,
pid
def
shutdown_server
(
addr
):
import
ZEO.ClientStorage
# XXX this doesn't work!
cli
=
ZEO
.
ClientStorage
.
ClientStorage
(
addr
)
cli
.
_server
.
rpc
.
callAsync
(
'shutdown'
)
def
main
():
def
main
(
client_func
=
None
):
if
VERBOSE
:
print
"Main process:"
,
os
.
getpid
()
addr
=
tempfile
.
mktemp
()
t0
=
time
.
time
()
server_pid
,
server
=
start_server
(
addr
)
t1
=
time
.
time
()
pids
=
[
start_client
(
addr
)
for
i
in
range
(
CLIENTS
)]
pids
=
[
start_client
(
addr
,
client_func
)
for
i
in
range
(
CLIENTS
)]
for
pid
in
pids
:
assert
type
(
pid
)
==
types
.
IntType
,
"invalid pid type: %s (%s)"
%
\
(
repr
(
pid
),
type
(
pid
))
...
...
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