Feature #17187
Add connect_timeout to TCPSocket
Description
Add connect_timeout to TCPSocket.new in the same way as Socket.tcp.
TCPSocket.new("192.0.2.1", 1234, connect_timeout: 1) #=> raise Errno::ETIMEDOUT
Files
Related issues
Updated by Glass_saga (Masaki Matsushita) 4 months ago
Pull Request: https://github.com/ruby/ruby/pull/3585
Updated by Glass_saga (Masaki Matsushita) 4 months ago
- Related to Feature #16381: Accept resolv_timeout in Net::HTTP added
Updated by Glass_saga (Masaki Matsushita) 4 months ago
- Related to Feature #17134: Add resolv_timeout to TCPSocket added
Updated by Glass_saga (Masaki Matsushita) 3 months ago
- Assignee set to Glass_saga (Masaki Matsushita)
- Status changed from Open to Assigned
Updated by Glass_saga (Masaki Matsushita) about 1 month ago
- Status changed from Assigned to Closed
Applied in changeset git|78f188524f551c97b1a7a44ae13514729f1a21c7.
Add connect_timeout to TCPSocket
Add connect_timeout to TCPSocket.new in the same way as Socket.tcp.
Closes [Feature #17187]
Updated by PhobosK (Phobos Kappa) 25 days ago
You forgot to add the new parameter connect_timeout to the return statement of the function socks_init in sockssocket.c.
Thus the now available official sources of Ruby 3.0.0 cannot compile when sockets are enabled giving the error:
x86_64-pc-linux-gnu-gcc -I. -I../../.ext/include/x86_64-linux -I../.././include -I../.././ext/socket -I../.. -I../../. -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -march=native -O2 -pipe -fno-strict-aliasing -fPIC -o sockssocket.o -c sockssocket.c sockssocket.c: In function ‘socks_init’: sockssocket.c:37:12: error: too few arguments to function ‘rsock_init_inetsock’ 37 | return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil); | ^~~~~~~~~~~~~~~~~~~ In file included from sockssocket.c:11: rubysocket.h:349:7: note: declared here 349 | VALUE rsock_init_inetsock(VALUE sock, VALUE remote_host, VALUE remote_serv, VALUE local_host, VALUE local_serv, int type, VALUE resolv_timeout, VALUE connect_timeout); | ^~~~~~~~~~~~~~~~~~~ make[2]: *** [Makefile:262: sockssocket.o] Error 1 make[2]: Leaving directory '/dev/shm/portage/dev-lang/ruby-3.0.0/work/ruby-3.0.0/ext/socket' make[1]: *** [exts.mk:285: ext/socket/all] Error 2 make[1]: Leaving directory '/dev/shm/portage/dev-lang/ruby-3.0.0/work/ruby-3.0.0' make: *** [uncommon.mk:300: build-ext] Error 2
I dunno if something else is missing also, but adding the Qnil as last parameter in line 37 of ext/socket/sockssocket.c
return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil, Qnil);
fixes at least the compilation....
Thanks.
Great work BTW :)
Updated by Glass_saga (Masaki Matsushita) 25 days ago
Many thanks for reporting the issue!
I merged your patch.