Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
ZODB
Commits
cc4feaa2
Commit
cc4feaa2
authored
Dec 12, 2002
by
Barry Warsaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed in favor of the (hopefully <wink>) cross platform zeoserver.py script.
parent
eac692f6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
82 deletions
+0
-82
src/ZEO/tests/winserver.py
src/ZEO/tests/winserver.py
+0
-82
No files found.
src/ZEO/tests/winserver.py
deleted
100644 → 0
View file @
eac692f6
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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
#
##############################################################################
"""Helper file used to launch ZEO server for Windows tests"""
import
asyncore
import
os
import
random
import
socket
import
threading
import
types
import
ZEO.StorageServer
class
ZEOTestServer
(
asyncore
.
dispatcher
):
"""A trivial server for killing a server at the end of a test
The server calls os._exit() as soon as it is connected to. No
chance to even send some data down the socket.
"""
__super_init
=
asyncore
.
dispatcher
.
__init__
def
__init__
(
self
,
addr
,
storage
):
self
.
__super_init
()
self
.
storage
=
storage
if
type
(
addr
)
==
types
.
StringType
:
self
.
create_socket
(
socket
.
AF_UNIX
,
socket
.
SOCK_STREAM
)
else
:
self
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
bind
(
addr
)
self
.
listen
(
5
)
def
handle_accept
(
self
):
sock
,
addr
=
self
.
accept
()
self
.
storage
.
close
()
os
.
_exit
(
0
)
def
load_storage_class
(
name
):
package
=
__import__
(
"ZODB."
+
name
)
mod
=
getattr
(
package
,
name
)
return
getattr
(
mod
,
name
)
def
main
(
args
):
ro_svr
=
0
if
args
[
0
]
==
"-r"
:
ro_svr
=
1
del
args
[
0
]
port
,
storage_name
,
rawargs
=
args
[
0
],
args
[
1
],
args
[
2
:]
klass
=
load_storage_class
(
storage_name
)
args
=
[]
for
arg
in
rawargs
:
if
arg
.
startswith
(
'='
):
arg
=
eval
(
arg
[
1
:],
{
'__builtins__'
:
{}})
args
.
append
(
arg
)
storage
=
klass
(
*
args
)
zeo_port
=
int
(
port
)
test_port
=
zeo_port
+
1
t
=
ZEOTestServer
((
''
,
test_port
),
storage
)
addr
=
(
''
,
zeo_port
)
serv
=
ZEO
.
StorageServer
.
StorageServer
(
addr
,
{
'1'
:
storage
},
ro_svr
)
asyncore
.
loop
()
# XXX The code below is evil because it can cause deadlocks in zrpc.
# (To fix it, calling ThreadedAsync._start_loop() might help.)
## import zLOG
## label = "winserver:%d" % os.getpid()
## while asyncore.socket_map:
## zLOG.LOG(label, zLOG.DEBUG, "map: %r" % asyncore.socket_map)
## asyncore.poll(30.0)
if
__name__
==
"__main__"
:
import
sys
main
(
sys
.
argv
[
1
:])
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