OpenSSLStatic::BlockingEventLoop
Inherits Crystal::EventLoop < Crystal::EventLoop::Socket < Crystal::EventLoop::FileDescriptor < Reference < Object
Constructors
Instance methods
Accepts an incoming TCP connection on the socket.
Blocks the current fiber if no connection is waiting, continuing when one becomes available. Otherwise returns immediately.
Returns a handle to the socket for the new connection.
FiberEvent#add (sleep/select timeouts) — no timers on a blocking loop: the thread waits inside the syscall itself.
Event#finalize calls this on every backend; ours never creates timer events (see #create_timeout_event), so it's a no-op.
Tells a blocking run loop to no longer wait for events to activate. It may for example enqueue a NOOP event with an immediate (or past) timeout. Having activated an event, the loop shall return, allowing the blocked thread to continue.
Should be a NOOP when the loop isn't running or is running in a nonblocking mode.
NOTE: we assume that multiple threads won't run the event loop at the same time in parallel, but this assumption may change in the future!
Same as #interrupt but returns true if a running event loop has likely
been interrupted, and false otherwise.
Opens a file at path.
Blocks the current fiber until the file has been opened. Avoids blocking
the current thread if possible, especially when blocking is false or
nil.
Returns the system file descriptor or handle, or a system error.
Opens an unidirectional pipe.
The implementation shall respect the specified blocking arguments for each end of the pipe, and follow its internal blocking requirements when a blocking arg is nil.
Returns a tuple with the reader and writer IO objects.
Reads at least one byte from the file descriptor into slice.
Blocks the current fiber if no data is available for reading, continuing when available. Otherwise returns immediately.
Returns the number of bytes read (up to slice.size).
Returns 0 when EOF is reached.
Reads at least one byte from the socket into slice.
Blocks the current fiber if no data is available for reading, continuing when available. Otherwise returns immediately.
Returns the number of bytes read (up to slice.size).
Returns 0 when the socket is closed and no data available.
Use #receive_from for capturing the source address of a message.
Receives at least one byte from the socket into slice, capturing the source address.
Blocks the current fiber if no data is available for reading, continuing when available. Otherwise returns immediately.
Returns a tuple containing the number of bytes received (up to slice.size)
and the source address.
kTLS path (OpenSSL::SSL::Socket with TLS 1.3 kernel offload): plain blocking recvmsg/sendmsg on the socket fd.
The scheduler entry point — never called: this loop is only handed out to scheduler-less (raw) threads, no one ever runs it.
Runs the loop.
Returns immediately if events are activable. Set blocking to false to
return immediately if there are no activable events; set it to true to wait
for activable events, which will block the current thread until then.
Returns true on normal returns (e.g. has activated events, has pending
events but blocking was false) and false when there are no registered
events.
Internal shutdown of the socket. Called after the Socket has been marked
closed but before calling #close to actually close the system socket fd
or handle.
Implementations shall resume all pending waiters and let them fail because
the IO has been closed. They don't have to call the shutdown syscall.
A real sleep for raw threads: nanosleep (thread-safe, no alarm), not a fiber park — there is no fiber here.
Creates a new socket file descriptor or handle and returns it, along with whether the blocking flag has been set.
Creates a pair of UNIX socket file descriptors or handles and returns them, along with whether the blocking mode has been set.
Blocks the current fiber until the socket is ready for read.
Blocks the current fiber until the socket is ready for write.
Writes at least one byte from slice to the socket.
Blocks the current fiber if the socket is not ready for writing, continuing when ready. Otherwise returns immediately.
Returns the number of bytes written (up to slice.size).
Use #send_to for sending a message to a specific target address.