summaryrefslogtreecommitdiff
path: root/ext/socket/socket.c
diff options
context:
space:
mode:
authorSamuel Williams <samuel.williams@oriontransfer.co.nz>2022-10-07 21:48:38 +1300
committerGitHub <noreply@github.com>2022-10-07 21:48:38 +1300
commite4f91bbdbaa6ab3125f24967414ac5300bb244f5 (patch)
tree575f8febdd50601522c5e5ec72f3436139304537 /ext/socket/socket.c
parente76217a7f3957c9cea52832c2f4237130411f7dd (diff)
Add IO#timeout attribute and use it for blocking IO operations. (#5653)
Notes
Notes: Merged-By: ioquatix <samuel@codeotaku.com>
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r--ext/socket/socket.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index b1965deb9e..5cf0835062 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -28,6 +28,10 @@ rsock_syserr_fail_host_port(int err, const char *mesg, VALUE host, VALUE port)
message = rb_sprintf("%s for %+"PRIsVALUE" port % "PRIsVALUE"",
mesg, host, port);
+ if (err == ETIMEDOUT) {
+ rb_exc_raise(rb_exc_new3(rb_eIOTimeoutError, message));
+ }
+
rb_syserr_fail_str(err, message);
}