Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
0b87831d
Commit
0b87831d
authored
Jul 31, 2014
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code in multiprocessing.Connection.send_bytes().
Followup to issue #20540; patch by Serhiy.
parent
cac9e719
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
9 deletions
+6
-9
Lib/multiprocessing/connection.py
Lib/multiprocessing/connection.py
+6
-9
No files found.
Lib/multiprocessing/connection.py
View file @
0b87831d
...
...
@@ -400,17 +400,14 @@ class Connection(_ConnectionBase):
if
n
>
16384
:
# The payload is large so Nagle's algorithm won't be triggered
# and we'd better avoid the cost of concatenation.
chunks
=
[
header
,
buf
]
elif
n
>
0
:
self
.
_send
(
header
)
self
.
_send
(
buf
)
else
:
# Issue # 20540: concatenate before sending, to avoid delays due
# to Nagle's algorithm on a TCP socket.
chunks
=
[
header
+
buf
]
else
:
# This code path is necessary to avoid "broken pipe" errors
# when sending a 0-length buffer if the other end closed the pipe.
chunks
=
[
header
]
for
chunk
in
chunks
:
self
.
_send
(
chunk
)
# Also note we want to avoid sending a 0-length buffer separately,
# to avoid "broken pipe" errors if the other end closed the pipe.
self
.
_send
(
header
+
buf
)
def
_recv_bytes
(
self
,
maxsize
=
None
):
buf
=
self
.
_recv
(
4
)
...
...
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