Class SSL.sslfile
- Description
 Interface similar to Stdio.File.
Handles blocking and nonblocking mode.
Handles callback mode in an arbitrary backend (also in blocking mode).
Read and write operations might each do both reading and writing. In callback mode that means that installing either a read or a write callback might install both internally. It also means that reading in one thread while writing in another doesn't work.
Callback changing operations like set_blocking and set_nonblocking aren't atomic.
Apart from the above, thread safety/atomicity characteristics are retained.
Blocking characterstics are retained for all functions.
is_open, connection init (create) and close (close) can do both reading and writing.
destroy attempts to close the stream properly by sending the close packet, but since it can't do blocking I/O it's not certain that it will succeed. The stream should therefore always be closed with an explicit close call.
Abrupt remote close without the proper handshake gets the errno
System.EPIPE.Objects do not contain cyclic references, so they are closed and destructed timely when dropped.
- Variable next_protocol
 stringSSL.sslfile.next_protocol- Description
 The next protocol chosen by the client during next protocol negotiation.
- Note
 Read only
- Method create
 SSL.sslfile SSL.sslfile(Stdio.Filestream,SSL.contextctx,int|voidis_client,int|voidis_blocking,SSL.Constants.ProtocolVersion|voidmin_version,SSL.Constants.ProtocolVersion|voidmax_version)- Description
 Create an SSL connection over an open stream.
- Parameter 
stream Open socket or pipe to create the connection over.
- Parameter 
ctx The SSL context.
- Parameter 
is_client If is set then a client-side connection is started, server-side otherwise.
- Parameter 
is_blocking If is set then the stream is initially set in blocking mode, nonblocking mode otherwise.
- Parameter 
min_version The minimum minor version of SSL to support. Defaults to
PROTOCOL_SSL_3_0.- Parameter 
max_version The maximum minor version of SSL to support. Defaults to
PROTOCOL_minor.The backend used by stream is taken over and restored after the connection is closed (see close and shutdown). The callbacks and id in stream are overwritten.
- Throws
 Throws errors on handshake failure in blocking client mode.
- Method destroy
 protectedvoiddestroy()- Description
 Try to close down the connection properly since it's customary to close files just by dropping them. No guarantee can be made that the close packet gets sent successfully though, because we can't risk blocking I/O here. You should call close explicitly.
- See also