summaryrefslogtreecommitdiff
path: root/ext/socket
AgeCommit message (Collapse)Author
2023-10-24rb_getaddrinfo should return EAI_AGAIN instead of EAGAINYusuke Endoh
2023-10-24Indent critical regions with blocksYusuke Endoh
Cosmetic change per ko1's preference
2023-10-24Do not use pthread on mingwYusuke Endoh
2023-10-24Make rb_getnameinfo interruptibleYusuke Endoh
Same as previous commit for rb_getnameinfo.
2023-10-24Make rb_getaddrinfo interruptibleYusuke Endoh
When pthread_create is available, rb_getaddrinfo creates a pthread and executes getaddrinfo(3) in it. The caller thread waits for the pthread to complete, but detaches it if interrupted. This allows name resolution to be interuppted by Timeout.timeout, etc. even if it takes a long time (for example, when the DNS server does not respond). [Feature #19965]
2023-10-24Expand macro branches to make them plainYusuke Endoh
2023-10-24Refactor GETADDRINFO_IMPL instead of GETADDRINFO_EMUYusuke Endoh
This is a preparation for introducing cancellable getaddrinfo/getnameinfo.
2023-10-24refactor a call to getaddrinfoYusuke Endoh
2023-10-17Use rb_getnameinfo instead of directly using getnameinfoYusuke Endoh
2023-08-30BasicSocket#recv* return `nil` rather than an empty packetJean Boussier
[Bug #19012] man recvmsg(2) states: > Return Value > These calls return the number of bytes received, or -1 if an error occurred. > The return value will be 0 when the peer has performed an orderly shutdown. Not too sure how one is supposed to make the difference between a packet of size 0 and a closed connection. Notes: Merged: https://github.com/ruby/ruby/pull/6407
2023-06-30Don't check for null pointer in calls to freePeter Zhu
According to the C99 specification section 7.20.3.2 paragraph 2: > If ptr is a null pointer, no action occurs. So we do not need to check that the pointer is a null pointer. Notes: Merged: https://github.com/ruby/ruby/pull/8004
2023-06-12[Feature #19719] Universal Parseryui-knk
Introduce Universal Parser mode for the parser. This commit includes these changes: * Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions are passed via `struct rb_parser_config_struct` when this macro is enabled. * Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu. Notes: Merged: https://github.com/ruby/ruby/pull/7927
2023-04-06Update VPATH for socket, & dependenciesMatt Valentine-House
The socket extensions rubysocket.h pulls in the "private" include/gc.h, which now depends on vm_core.h. vm_core.h pulls in id.h when tool/update-deps generates the dependencies for the makefiles, it generates the line for id.h to be based on VPATH, which is configured in the extconf.rb for each of the extensions. By default VPATH does not include the actual source directory of the current Ruby so the dependency fails to resolve and linking fails. We need to append the topdir and top_srcdir to VPATH to have the dependancy picked up correctly (and I believe we need both of these to cope with in-tree and out-of-tree builds). I copied this from the approach taken in https://github.com/ruby/ruby/blob/master/ext/objspace/extconf.rb#L3 Notes: Merged: https://github.com/ruby/ruby/pull/7393
2023-02-28Update the depend filesMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7310
2023-02-27Remove intern/gc.h from Make depsMatt Valentine-House
Notes: Merged: https://github.com/ruby/ruby/pull/7330
2023-02-08Extract include/ruby/internal/attr/packed_struct.hNobuyoshi Nakada
Split `PACKED_STRUCT` and `PACKED_STRUCT_UNALIGNED` macros into the macros bellow: * `RBIMPL_ATTR_PACKED_STRUCT_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_END` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_BEGIN` * `RBIMPL_ATTR_PACKED_STRUCT_UNALIGNED_END` Notes: Merged: https://github.com/ruby/ruby/pull/7268
2023-01-30Extract check for RSTRING_SOCKLENNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/7195
2023-01-16fix typo in comments / autodocRick Hull
replace _socktype_ with _type_ in the comments Notes: Merged: https://github.com/ruby/ruby/pull/7127
2022-12-15Remove `require 'io/wait'` where it's no longer necessary. (#6932)Samuel Williams
* Remove `require 'io/wait'` as it's part of core now. * Update ruby specs using version gates. * Add note about why it's conditional. Notes: Merged-By: ioquatix <[email protected]>
2022-12-15socket.rb - simplify check for the methodNobuyoshi Nakada
2022-12-14socket.rb - don't load io/wait (#6922)MSP-Greg
See d2166c09b08fc1 and #6036 for more context. Notes: Merged-By: ioquatix <[email protected]>
2022-11-30Removed documentation for incomplete option about [Feature #17134]Hiroshi SHIBATA
2022-11-21Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/6777
2022-11-17Add support for `sockaddr_un` on Windows. (#6513)Samuel Williams
* Windows: Fix warning about undefined if_indextoname() * Windows: Fix UNIXSocket on MINGW and make .pair more reliable * Windows: Use nonblock=true for read tests with scheduler * Windows: Move socket detection from File.socket? to File.stat Add S_IFSOCK to Windows and interpret reparse points accordingly. Enable tests that work now. * Windows: Use wide-char functions to UNIXSocket This fixes behaviour with non-ASCII characters. It also fixes deletion of temporary UNIXSocket.pair files. * Windows: Add UNIXSocket tests for specifics of Windows impl. * Windows: fix VC build due to missing _snwprintf Avoid usage of _snwprintf, since it fails linking ruby.dll like so: linking shared-library x64-vcruntime140-ruby320.dll x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l whereas linking miniruby.exe succeeds. This patch uses snprintf on the UTF-8 string instead. Also remove branch GetWindowsDirectoryW, since it doesn't work. * Windows: Fix dangling symlink test failures Co-authored-by: Lars Kanis <[email protected]> Notes: Merged-By: ioquatix <[email protected]>
2022-11-10Transition shape when object's capacity changesJemma Issroff
This commit adds a `capacity` field to shapes, and adds shape transitions whenever an object's capacity changes. Objects which are allocated out of a bigger size pool will also make a transition from the root shape to the shape with the correct capacity for their size pool when they are allocated. This commit will allow us to remove numiv from objects completely, and will also mean we can guarantee that if two objects share shapes, their IVs are in the same positions (an embedded and extended object cannot share shapes). This will enable us to implement ivar sets in YJIT using object shapes. Co-Authored-By: Aaron Patterson <[email protected]> Notes: Merged: https://github.com/ruby/ruby/pull/6699
2022-11-09Use `rb_sprintf` instead of deprecated `sprintf`Nobuyoshi Nakada
2022-11-04Substitute from the actual netinet6/in6.hNobuyoshi Nakada
Xcode no longer links the system include files directory to `/usr`. Extract the actual header file path from cpp output.
2022-10-08Try `nil` as default for 'default timeout'. (#6509)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-10-07Add IO#timeout attribute and use it for blocking IO operations. (#5653)Samuel Williams
Notes: Merged-By: ioquatix <[email protected]>
2022-09-21sockopt adding Linux constants, SO_INCOMING_CPU/SO_INCOMING_NAPI_ID.David Carlier
2022-09-21openbsd sockets add SO_RTABLE constantDavid Carlier
Notes: Merged: https://github.com/ruby/ruby/pull/4635
2022-09-21Introduces FreeBSD's SO_USER_COOKIE among socketopt's options.David Carlier
Notes: Merged: https://github.com/ruby/ruby/pull/4206
2022-09-21sockets add `TCP_CONNECTION_INFO` and `TCP_KEEPALIVE` constants.David CARLIER
Notes: Merged: https://github.com/ruby/ruby/pull/5871
2022-09-21socket add FreeBSD's SO_SETFIB constant.David CARLIER
Notes: Merged: https://github.com/ruby/ruby/pull/5917
2022-09-20[DOC] socket: fix wrong sample addresses (#6372)Sutou Kouhei
IPv6 link local address is fe80::/10 not ff80::/10: https://www.rfc-editor.org/rfc/rfc4291.html Link-Local unicast 1111111010 FE80::/10 2.5.6 IPv6 (deprecated) site local address is fec0::/10 not ffc0::/10: https://www.rfc-editor.org/rfc/rfc3513.html Site-local unicast 1111111011 FEC0::/10 2.5.6 Notes: Merged-By: kou <[email protected]>
2022-07-21Expand tabs [ci skip]Takashi Kokubun
[Misc #18891] Notes: Merged: https://github.com/ruby/ruby/pull/6094
2022-03-17Fix broken links of rdocKazuhiro NISHIYAMA
- `www.ruby-lang.org` links to `./www.ruby-lang.org` - `cgi['field_name']` links to `./'field_name'`
2022-02-22[Feature #18249] Update dependenciesPeter Zhu
Notes: Merged: https://github.com/ruby/ruby/pull/5474
2022-01-18[Feature #18491] Drop support for HP-UXPeter Zhu
IA64 support was dropped in ticket #15894, so we can drop support for HP-UX. Notes: Merged: https://github.com/ruby/ruby/pull/5457
2021-11-21Update dependenciesNobuyoshi Nakada
2021-11-02ext/socket/extconf.rb: Fix the chech if if_indextoname is availableYusuke Endoh
The check had not work because "headers" were not passed.
2021-10-14Prefer the reentrant versions of gmtime and localtimeNobuyoshi Nakada
2021-10-12Add more socket constantsKazuhiro NISHIYAMA
from http://manpages.ubuntu.com/manpages/focal/en/man2/socket.2.html Notes: Merged: https://github.com/ruby/ruby/pull/4955
2021-10-05ruby tool/update-deps --fix卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4909
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: https://github.com/ruby/ruby/pull/4604
2021-07-12Avoid calling `fstat` on things we already know are valid sockets.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4645
2021-06-23Convert ssize_t properlyNobuyoshi Nakada
2021-06-22Deprecate and rework old (fd) centric functions.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4592
2021-06-22Direct io for accept, send, sendmsg, recvfrom, and related methods.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4477