aboutsummaryrefslogtreecommitdiffstats
path: root/ext/socket
Commit message (Collapse)AuthorAgeFilesLines
* [DOC] Fix grammar: "is same as" -> "is the same as"Marcus Stollsteimer2021-01-052-4/+4
|
* Fix compile error of sockssocketMasaki Matsushita2020-12-291-1/+1
| | | | | | | | The patch is provided by PhobosK (Phobos Kappa). This should be backported to Ruby 3.0. [Feature #17187]
* Removed rb_cData entityNobuyoshi Nakada2020-12-222-2/+2
| | | | | | | * 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
* socket is ractor-safe.Koichi Sasada2020-12-181-0/+2
|
* Remove unimplemented parameter from commentMasaki Matsushita2020-12-111-2/+1
| | | | :resolv_timeout of TCPSocket.new is not implemented for now.
* Add connect_timeout to TCPSocketMasaki Matsushita2020-12-108-20/+38
| | | | | | Add connect_timeout to TCPSocket.new in the same way as Socket.tcp. Closes [Feature #17187]
* Revert getaddrinfo_a()Masaki Matsushita2020-12-075-265/+0
| | | | | | | | 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]
* Call cleanup function for getaddrinfo_a(3) only before fork()Masaki Matsushita2020-12-061-2/+2
| | | | | | 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().
* Extend sleep time to 1.5 second in rb_getaddrinfo_a_before_exec()Masaki Matsushita2020-12-061-1/+4
| | | | | After 94d49ed31c, TestSocket#test_getaddrinfo_after_fork fails in some platforms. To avoid this, the change extends sleep time to 1.5 second.
* Add a hook before fork() for getaddrinfo_a()Masaki Matsushita2020-12-041-0/+116
| | | | | | | | | 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]
* ext/socket/rubysocket.h: avoid the conflict of T_DATA definition in AIXRei Odaira2020-11-011-1/+1
|
* Use public allocators for creating new T_OBJECT objectsAaron Patterson2020-10-282-4/+4
| | | | This way the header flags and object internals are set correctly
* ext/socket/ipsocket.c: prevent "warning: unused variable 'resolv_timeout'"Yusuke Endoh2020-09-271-2/+1
|
* Add comments for resolv_timeoutMasaki Matsushita2020-09-251-1/+3
|
* Add resolve_timeout to TCPSocket [Feature #17134]Masaki Matsushita2020-09-256-8/+52
|
* Show deprecation warning on Socket.gethostbyname and Socket.gethostbyaddrMasaki Matsushita2020-08-291-0/+3
|
* Show deprecation warning on TCPSocket.gethostbynameMasaki Matsushita2020-08-281-0/+1
|
* Adjust indents [ci skip]Nobuyoshi Nakada2020-08-272-14/+14
|
* sed -i '/rmodule.h/d'卜部昌平2020-08-271-15/+0
|
* Make Socket.getaddrinfo interruptible (#2827)Kir Shatrov2020-08-273-17/+23
| | | | | | | | | | | | | | | | | | | 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: https://bugs.ruby-lang.org/issues/16476 https://bugs.ruby-lang.org/issues/16381 https://bugs.ruby-lang.org/issues/14997
* sed -i '/r_cast.h/d'卜部昌平2020-08-271-15/+0
|
* sed -i '\,2/extern.h,d'卜部昌平2020-08-271-15/+0
|
* Thread scheduler for light weight concurrency.Samuel Williams2020-05-145-199/+66
|
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-2100/+2100
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-2100/+2100
| | | | This shall fix compile errors.
* Fix a typo [ci skip]Kazuhiro NISHIYAMA2020-04-271-1/+1
|
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-082-15/+2290
| | | Split ruby.h
* ext/socket/init.c: do not return uninitialized bufferYusuke Endoh2020-03-311-9/+8
| | | | | | | Resize string buffer only if some data is received in BasicSocket#read_nonblock and some methods. Co-Authored-By: Samuel Williams <samuel.williams@oriontransfer.co.nz>
* Updated dependencies on internal/warnings.hNobuyoshi Nakada2019-12-311-0/+15
| | | | | Needed for `UNALIGNED_MEMBER_ACCESS` using `COMPILER_WARNING_`* macros.
* update dependencies卜部昌平2019-12-261-0/+165
|
* decouple internal.h headers卜部昌平2019-12-261-15/+34
| | | | | | | | | | | | | | | | | | 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).
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-184-20/+7
| | | | | | 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.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-183-8/+2
| | | | | | | | | | | | | | | | | 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.
* Clean up implementation of SOCKSSocket, its confusing and undocumentedJustin McNally2019-11-011-4/+10
|
* Prefer libsocksd over libsocksJustin McNally2019-11-011-1/+1
|
* Support libsocksd socks library for SOCKSSocketJustin McNally2019-11-011-1/+1
|
* Support timeout for AddrinfoMasaki Matsushita2019-09-103-13/+145
| | | | | | | | | | | | 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.
* Revert "Support timeout for Addrinfo"Masaki Matsushita2019-09-093-145/+13
| | | | | This reverts commit 6382f5cc91ac9e36776bc854632d9a1237250da7. test failed on Solaris.
* Support timeout for AddrinfoMasaki Matsushita2019-09-093-13/+145
| | | | | | | | 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.
* drop-in type check for rb_define_singleton_method卜部昌平2019-08-292-6/+6
| | | | | | We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
* rb_ensure now free from ANYARGS卜部昌平2019-08-273-6/+12
| | | | | | After 5e86b005c0f2ef30df2f9906c7e2f3abefe286a2, I now think ANYARGS is dangerous and should be extinct. This commit deletes ANYARGS from rb_ensure, which also revealed many arity / type mismatches.
* Hoisted out unixsocket_len, triming NUL chars from sun_pathNobuyoshi Nakada2019-08-161-29/+30
|
* Constified afamily functionsNobuyoshi Nakada2019-07-161-3/+3
|
* socket: use frozen string buffer when releasing GVLTanaka Akira2019-07-141-2/+5
| | | | Thanks for the patch by normalperson (Eric Wong) [Bug #14204].
* Include ruby/assert.h in ruby/ruby.h so that assertions can be thereNobuyoshi Nakada2019-07-141-0/+15
|
* * expand tabs.git2019-06-111-3/+3
|
* ext/socket/ipsocket.c: Use SO_REUSEADDR for local_host/portYusuke Endoh2019-06-111-0/+5
| | | | | | | Sometimes ruby/spec fails when trying to specify local_host and local_port for TCPSocket.open. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190610T192504Z.fail.html.gz
* Suppress paranoid warnings for external/3rd-party librariesNobuyoshi Nakada2019-05-231-0/+1
| | | | [Feature #15665]
* Removed moving toplevel header since r12501nobu2019-02-081-15/+15
| | | | | | | Moving public headers was 12-years ago, no depend files would expect ruby.h in the top source directory now. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67033 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix indents [ci skip]nobu2018-12-311-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e