diff options
author | Samuel Williams <[email protected]> | 2022-10-07 21:48:38 +1300 |
---|---|---|
committer | GitHub <[email protected]> | 2022-10-07 21:48:38 +1300 |
commit | e4f91bbdbaa6ab3125f24967414ac5300bb244f5 (patch) | |
tree | 575f8febdd50601522c5e5ec72f3436139304537 /ext/socket/socket.c | |
parent | e76217a7f3957c9cea52832c2f4237130411f7dd (diff) |
Add IO#timeout attribute and use it for blocking IO operations. (#5653)
Notes
Notes:
Merged-By: ioquatix <[email protected]>
Diffstat (limited to 'ext/socket/socket.c')
-rw-r--r-- | ext/socket/socket.c | 4 |
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); } |