path: root/ext/socket
AgeCommit message (Collapse)Author
12 daysPrefer the reentrant versions of gmtime and localtimeNobuyoshi Nakada
14 daysAdd more socket constantsKazuhiro NISHIYAMA
from Notes: Merged:
2021-10-05ruby tool/update-deps --fix卜部昌平
Notes: Merged:
2021-09-23[DOC] Use `unpack1` instead of `unpack(template)[0]` [ci skip]Kazuhiro NISHIYAMA
2021-08-20undefine alloc functions for C extensionsMike Dalessio
per guidance in doc/extension.rdoc, these classes now undefine their alloc functions: - ObjectSpace::InternalObjectWrapper - Socket::Ifaddr Notes: Merged:
2021-07-12Avoid calling `fstat` on things we already know are valid sockets.Samuel Williams
Notes: Merged:
2021-06-23Convert ssize_t properlyNobuyoshi Nakada
2021-06-22Deprecate and rework old (fd) centric functions.Samuel Williams
Notes: Merged:
2021-06-22Direct io for accept, send, sendmsg, recvfrom, and related methods.Samuel Williams
Notes: Merged:
2021-06-14Removed no longer used variablesNobuyoshi Nakada
2021-06-14Add scheduler hook `Addrinfo.getaddrinfo`. (#4375)Samuel Williams
Co-authored-by: Bruno Sutic <> Notes: Merged-By: ioquatix <>
2021-04-13dependency updates卜部昌平
Notes: Merged:
2021-02-04[DOC] Fix typo in ext/socket/socket.c [ci skip]Dimitris Zorbas
Notes: Merged:
2021-01-05[DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer
2020-12-29Fix compile error of sockssocketMasaki Matsushita
The patch is provided by PhobosK (Phobos Kappa). This should be backported to Ruby 3.0. [Feature #17187]
2020-12-22Removed rb_cData entityNobuyoshi Nakada
* Use the wrapper of rb_cObject instead of data access * Replaced rest of extentions * Updated the version guard for Data * Added the version guard of rb_cData Notes: Merged:
2020-12-18socket is ractor-safe.Koichi Sasada
2020-12-11Remove unimplemented parameter from commentMasaki Matsushita
:resolv_timeout of is not implemented for now.
2020-12-10Add connect_timeout to TCPSocketMasaki Matsushita
Add connect_timeout to in the same way as Socket.tcp. Closes [Feature #17187]
2020-12-07Revert getaddrinfo_a()Masaki Matsushita
getaddrinfo_a() gets stuck after fork(). To avoid this, we need 1 second sleep to wait for internal worker threads of getaddrinfo_a() to be finished, but that is unacceptable. [Bug #17220] [Feature #17134] [Feature #17187]
2020-12-06Call cleanup function for getaddrinfo_a(3) only before fork()Masaki Matsushita
Previously, rb_getaddrinfo_a_before_exec() is called from before_exec(). However, the function needs to be called only before fork(). The change moves it to before_fork().
2020-12-06Extend sleep time to 1.5 second in rb_getaddrinfo_a_before_exec()Masaki Matsushita
After 94d49ed31c, TestSocket#test_getaddrinfo_after_fork fails in some platforms. To avoid this, the change extends sleep time to 1.5 second.
2020-12-04Add a hook before fork() for getaddrinfo_a()Masaki Matsushita
We need stop worker threads in getaddrinfo_a() before fork(). This change adds a hook before fork() that cancel all outstanding requests and wait for all ongoing requests. Then, it waits for all worker threads to be finished. Fixes [Bug #17220]
2020-11-01ext/socket/rubysocket.h: avoid the conflict of T_DATA definition in AIXRei Odaira
2020-10-28Use public allocators for creating new T_OBJECT objectsAaron Patterson
This way the header flags and object internals are set correctly Notes: Merged:
2020-09-27ext/socket/ipsocket.c: prevent "warning: unused variable 'resolv_timeout'"Yusuke Endoh
2020-09-25Add comments for resolv_timeoutMasaki Matsushita
2020-09-25Add resolve_timeout to TCPSocket [Feature #17134]Masaki Matsushita
2020-08-29Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddrMasaki Matsushita
2020-08-28Show deprecation warning on TCPSocket.gethostbynameMasaki Matsushita
2020-08-27Adjust indents [ci skip]Nobuyoshi Nakada
2020-08-27sed -i '/rmodule.h/d'卜部昌平
Notes: Merged:
2020-08-27Make Socket.getaddrinfo interruptible (#2827)Kir Shatrov
Before, Socket.getaddrinfo was using a blocking getaddrinfo(3) call. That didn't allow to wrap it into Timeout.timeout or interrupt the thread in any way. Combined with the default 10 sec resolv timeout on many Unix systems, this can have a very noticeable effect on production Ruby apps being not resilient to DNS outages and timing out name resolution, and being unable to fail fast even with Timeout.timeout. Since we already have support for getaddrinfo_a(3), the async version of getaddrinfo, we should be able to make Socket.getaddrinfo leverage that when getaddrinfo_a version is available in the system (hence #ifdef HAVE_GETADDRINFO_A). Related tickets: Notes: Merged-By: mmasaki <>
2020-08-27sed -i '/r_cast.h/d'卜部昌平
Notes: Merged:
2020-08-27sed -i '\,2/extern.h,d'卜部昌平
Notes: Merged:
2020-05-14Thread scheduler for light weight concurrency.Samuel Williams
Notes: Merged: Merged-By: ioquatix <>
2020-05-11sed -i 's|ruby/impl|ruby/internal|'卜部昌平
To fix build failures. Notes: Merged:
2020-05-11sed -i s|ruby/3|ruby/impl|g卜部昌平
This shall fix compile errors. Notes: Merged:
2020-04-27Fix a typo [ci skip]Kazuhiro NISHIYAMA
2020-04-08Merge pull request #2991 from shyouhei/ruby.h卜部昌平
Split ruby.h Notes: Merged-By: shyouhei <>
2020-03-31ext/socket/init.c: do not return uninitialized bufferYusuke Endoh
Resize string buffer only if some data is received in BasicSocket#read_nonblock and some methods. Co-Authored-By: Samuel Williams <>
2019-12-31Updated dependencies on internal/warnings.hNobuyoshi Nakada
Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`* macros. Notes: Merged:
2019-12-26update dependencies卜部昌平
Notes: Merged:
2019-12-26decouple internal.h headers卜部昌平
Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies). Notes: Merged:
2019-11-18Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby. Notes: Merged:
2019-11-18Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans
This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd. Notes: Merged:
2019-11-01Clean up implementation of SOCKSSocket, its confusing and undocumentedJustin McNally
Notes: Merged:
2019-11-01Prefer libsocksd over libsocksJustin McNally
Notes: Merged:
2019-11-01Support libsocksd socks library for SOCKSSocketJustin McNally
Notes: Merged:
2019-09-10Support timeout for AddrinfoMasaki Matsushita
Addrinfo.getaddrinfo and .foreach now accepts :timeout in seconds as a keyword argument. If getaddrinfo_a(3) is available, the timeout will be applied for name resolution. Otherwise, it will be ignored. Socket.tcp accepts :resolv_timeout to use this feature. This commit is retry of 6382f5cc91ac9e36776bc854632d9a1237250da7. Test was failed on Solaris machines which don't have "http" in /etc/services. In this commit, use "ssh" instead.