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
nexedi
ZODB
Commits
2e9595fd
Commit
2e9595fd
authored
May 11, 2007
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a should_close method that allows connection closes to be
queued.
parent
3600059c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
1 deletion
+12
-1
src/ZEO/zrpc/smac.py
src/ZEO/zrpc/smac.py
+12
-1
No files found.
src/ZEO/zrpc/smac.py
View file @
2e9595fd
...
@@ -68,6 +68,8 @@ SEND_SIZE = 60000
...
@@ -68,6 +68,8 @@ SEND_SIZE = 60000
MAC_BIT
=
0x80000000
L
MAC_BIT
=
0x80000000
L
_close_marker
=
object
()
class
SizedMessageAsyncConnection
(
asyncore
.
dispatcher
):
class
SizedMessageAsyncConnection
(
asyncore
.
dispatcher
):
__super_init
=
asyncore
.
dispatcher
.
__init__
__super_init
=
asyncore
.
dispatcher
.
__init__
__super_close
=
asyncore
.
dispatcher
.
close
__super_close
=
asyncore
.
dispatcher
.
close
...
@@ -235,6 +237,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
...
@@ -235,6 +237,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
else
:
else
:
return
True
return
True
def
should_close
(
self
):
self
.
__output
.
append
(
_close_marker
)
def
handle_write
(
self
):
def
handle_write
(
self
):
self
.
__output_lock
.
acquire
()
self
.
__output_lock
.
acquire
()
try
:
try
:
...
@@ -250,7 +255,13 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
...
@@ -250,7 +255,13 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
l
=
0
l
=
0
for
i
in
range
(
len
(
output
)):
for
i
in
range
(
len
(
output
)):
l
+=
len
(
output
[
i
])
try
:
l
+=
len
(
output
[
i
])
except
TypeError
:
# We had an output marker, close the connection
assert
output
[
i
]
is
_close_marker
return
self
.
close
()
if
l
>
SEND_SIZE
:
if
l
>
SEND_SIZE
:
break
break
...
...
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