Issue #17187 has been updated by PhobosK (Phobos Kappa).

File ruby3-socksocket-fix.patch added

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

``` cpp
return rsock_init_inetsock(sock, host, port, Qnil, Qnil, INET_SOCKS, Qnil, Qnil);
```
fixes at least the compilation....

Thanks.

Great work BTW :)


----------------------------------------
Feature #17187: Add connect_timeout to TCPSocket
https://bugs.ruby-lang.org/issues/17187#change-89611

* Author: Glass_saga (Masaki Matsushita)
* Status: Closed
* Priority: Normal
* Assignee: Glass_saga (Masaki Matsushita)
----------------------------------------
Add connect_timeout to TCPSocket.new in the same way as Socket.tcp.

```ruby
TCPSocket.new("192.0.2.1", 1234, connect_timeout: 1) #=> raise Errno::ETIMEDOUT
```

---Files--------------------------------
connect_timeout.patch (8.93 KB)
ruby3-socksocket-fix.patch (361 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>