Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
return pollin(events, timeout).length != 0
end
- # Checks if the socket still is connected
+ # Is this socket still connected?
fun connected: Bool
do
if closed then return false
- var events = [new NativeSocketPollValues.pollhup, new NativeSocketPollValues.pollerr]
- if pollin(events, 0).length == 0 then
+ if native.poll_hup_err == 0 then
return true
else
closed = true
return filedesc.check_response(result)
end
+ # Poll this socket with `POLLHUP|POLLERR`
+ #
+ # A return value of 0 means there is no errors.
+ fun poll_hup_err: Int `{
+ struct pollfd fd = {*self, POLLHUP|POLLERR, 0};
+ int res = poll(&fd, 1, 0);
+ return res;
+ `}
+
# Call to the poll function of the C socket
#
# Signature: