Added complete call-seq documentation for socket programming methods across
all major socket classes in both mrblib/socket.rb (64 Ruby methods) and
src/socket.c (35 C methods):
- Addrinfo: Complete documentation for address information handling including
creation (new, foreach, ip, tcp, udp, unix), inspection (inspect,
inspect_sockaddr, to_s), address queries (afamily, pfamily, ipv4?, ipv6?,
ip?, unix?), data extraction (ip_address, ip_port, ip_unpack, unix_path),
and conversion methods (to_sockaddr, getnameinfo)
- BasicSocket: Core socket functionality including class configuration
(do_not_reverse_lookup, do_not_reverse_lookup=), object creation (for_fd),
address retrieval (local_address, remote_address), and non-blocking
operations (recv_nonblock)
- IPSocket: Internet protocol socket operations including address information
(addr, peeraddr), connection methods (bind, connect), data transfer
(send, recvfrom, recvfrom_nonblock), and address resolution (getaddress)
- TCPSocket/TCPServer: TCP client and server socket operations including
connection establishment (new, open), server operations (accept,
accept_nonblock, listen, sysaccept)
- UDPSocket: UDP socket operations for datagram communication including
initialization and internal address handling
- Socket: Low-level socket operations including creation (new, open),
address manipulation (sockaddr_in, sockaddr_un, unpack_sockaddr_in,
unpack_sockaddr_un), connection management (bind, connect, listen),
data transfer (recvfrom, recvfrom_nonblock), socket pairs (pair),
and name resolution (getaddrinfo, getnameinfo)
- UNIXSocket/UNIXServer: Unix domain socket operations for local IPC
including creation (new, socketpair), path handling (path, addr, peeraddr),
server operations (accept, accept_nonblock, listen, sysaccept), and
data transfer (recvfrom)
- Addrinfo: Core address resolution methods including getaddrinfo for name
resolution, getnameinfo for reverse lookups, and unix_path for Unix
domain socket paths
- BasicSocket: Low-level socket operations including getpeereid for peer
credentials, getpeername/getsockname for address retrieval, recv/send
for data transfer, getsockopt/setsockopt for option management,
shutdown for connection termination, and Windows-specific overrides
(close, sysread, sysseek, syswrite)
- IPSocket: Internet protocol utilities including ntop/pton for address
conversion and recvfrom for receiving data with sender information
- Socket: Core socket creation and management including gethostname,
internal methods (_accept, _bind, _connect, _listen, _socket),
address utilities (sockaddr_un, socketpair), and platform-specific
implementations
- Socket::Option: Socket option handling including creation from boolean/
integer values, accessor methods (family, level, optname, data),
type conversion (int, bool), and debugging support (inspect)
All methods now have comprehensive call-seq documentation with practical
This significantly improves maintainability and usability of errno
handling for developers working with system call errors and file
operations in embedded Ruby environments.
Co-authored-by: Atlassian Rovo Dev
Fixed critical resource leaks by pre-allocating mruby objects before system
calls. Since mrb_str_resize to smaller size and mrb_ary_push within
pre-allocated size cannot fail, moving allocations before socket creation
eliminates all leak potential with minimal code changes.
Co-authored-by: Atlassian Rovo Dev
Internal functions can only be called from within the library.
Functions listed in `mruby/internal.h` can be called from:
* core (src/*.c)
* gems (mrbgems/**/*.c)
But not from the application linked with `libmruby`.