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
675f24dd
Commit
675f24dd
authored
May 18, 2014
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #21430: additions to the description of non-blocking SSL sockets
parent
92d0a541
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
Doc/library/ssl.rst
Doc/library/ssl.rst
+20
-3
No files found.
Doc/library/ssl.rst
View file @
675f24dd
...
...
@@ -1588,8 +1588,19 @@ the sockets in non-blocking mode and use an event loop).
Notes on non-blocking sockets
-----------------------------
When working with non-blocking sockets, there are several things you need
to be aware of:
SSL sockets behave slightly different than regular sockets in
non-blocking mode. When working with non-blocking sockets, there are
thus several things you need to be aware of:
- Most :class:`SSLSocket` methods will raise either
:exc:`SSLWantWriteError` or :exc:`SSLWantReadError` instead of
:exc:`BlockingIOError` if an I/O operation would
block. :exc:`SSLWantReadError` will be raised if a read operation on
the underlying socket is necessary, and :exc:`SSLWantWriteError` for
a write operation on the underlying socket. Note that attempts to
*write* to an SSL socket may require *reading* from the underlying
socket first, and attempts to *read* from the SSL socket may require
a prior *write* to the underlying socket.
- Calling :func:`~select.select` tells you that the OS-level socket can be
read from (or written to), but it does not imply that there is sufficient
...
...
@@ -1598,8 +1609,14 @@ to be aware of:
and :meth:`SSLSocket.send` failures, and retry after another call to
:func:`~select.select`.
- Conversely, since the SSL layer has its own framing, a SSL socket may
still have data available for reading without :func:`~select.select`
being aware of it. Therefore, you should first call
:meth:`SSLSocket.recv` to drain any potentially available data, and then
only block on a :func:`~select.select` call if still necessary.
(of course, similar provisions apply when using other primitives such as
:func:`~select.poll`)
:func:`~select.poll`
, or those in the :mod:`selectors` module
)
- The SSL handshake itself will be non-blocking: the
:meth:`SSLSocket.do_handshake` method has to be retried until it returns
...
...
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