summaryrefslogtreecommitdiff
path: root/lib/kernel/src/gen_tcp_socket.erl
Commit message (Collapse)AuthorAgeFilesLines
* Ignore option errors more like inet_drvRaimo Niskanen2023-02-091-7/+5
|
* Benchmark prototype distribution over socketRaimo Niskanen2023-02-091-2/+2
|
* Implement inet_epmd_distRaimo Niskanen2023-02-091-0/+29
| | | | | | | | | | | | | | | A distribution plug-in that implements the boilerplate for distribution using EPMD over the inet address family. inet6 is a future exercise. inet_epmd_dist itself can take plug-ins that implement the socket stuff, and it can itself act as a plug-in to itself that mimics the default -proto_dist inet_tcp. Also implement a plug-in to inet_epmd_dist: inet_epmd_socket that implements the regular inet_tcp_dist distribution but over the socket API.
* Fix incorrect translation of low_watermarkRaimo Niskanen2023-02-091-1/+1
| | | | | | | | | | | | | low_watermark is a local inet_drv option, not to be confused with SO_RCVLOWAT. The inet_drv option works on the output buffer to decide when to unblock a busy port, but the socket option is an input threshold for when to deliver input data. Not the same at all. Incorrectly activating SO_RCVLOWAT on e.g a distribution socket can block the initial distribution handshake and cause a failed connection setup.
* Merge branch ↵Micael Karlberg2022-12-191-0/+6
|\ | | | | | | 'bmk/kernel/20221208/bind_to_device_value_type_conflict/24/OTP-18357' into maint
| * kernel|esock] Add bind_to_device value typoe translationMicael Karlberg2022-12-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently we have a value type conflict: prim_inet: binary() socket: string() So, we add a value type translation for bind-to-devic from binary() -> string(). OTP-18357
* | Merge branch 'bmk/kernel/20221116/gen_tcp_socket_shutdown/25.1/OTP-18270' ↵Micael Karlberg2022-11-251-1/+1
|\ \ | | | | | | | | | into maint
| * | [kernel|gen-tcp-socket] Shutdown results in crashMicael Karlberg2022-11-231-1/+1
| | | | | | | | | | | | | | | | | | Adjust server shutdown to produce a "nicer" termination. OTP-18270
* | | Merge branch 'bmk/kernel/20221111/gen_tcp_socket_warning_msg/OTP-18317' into ↵Micael Karlberg2022-11-161-8/+14
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | maint Improve warning message format for gen_tcp_socket. OTP-18317
| * | [kernel] Improve gen_tcp_socket warning messageMicael Karlberg2022-11-111-8/+14
| |/ | | | | | | | | | | Improve (unknown event) warning message from gen_tcp_socket. OTP-18317
| * Merge branch 'bmk/kernel/20220427/gen_tcp_socket_shutdown_24.3.3/OTP-18080' ↵Erlang/OTP2022-05-021-1/+11
| |\ | | | | | | | | | | | | | | | | | | | | | | | | into maint-24 * bmk/kernel/20220427/gen_tcp_socket_shutdown_24.3.3/OTP-18080: [kernel|gen-tcp|test] Tweaked shutdown (api) test case(s) [kernel|gen-tcp-socket] Changed the behaviour of shutdown [erts|esock] Add caller pid to the initial debug printout for close
* | \ Merge branch 'maint'Micael Karlberg2022-05-021-1/+11
|\ \ \ | | | | | | | | | | | | OTP-18080
| * \ \ Merge branch 'bmk/kernel/20220427/gen_tcp_socket_shutdown_24.3.3/OTP-18080' ↵Micael Karlberg2022-05-021-1/+11
| |\ \ \ | | |/ / | |/| / | | |/ | | | | | | into maint OTP-18080
| | * [kernel|gen-tcp-socket] Changed the behaviour of shutdownMicael Karlberg2022-04-291-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | The behaviour of shutdown was changed to be more compatible with the "old" gen_tcp (that is, gen_tcp used with inet_backend = inet, which is *currently* default). OTP-18080
* | | Merge branch 'maint'Micael Karlberg2022-05-021-14/+31
|\ \ \ | |/ / | | | | | | OTP-18078
| * | [kernel] Fixed handling of raw option for gen-tcp-socketMicael Karlberg2022-04-291-14/+31
| |/ | | | | | | | | | | | | When using inet-backend socket, getopts of the raw option failed badly. OTP-18078
* | Merge branch 'maint'Raimo Niskanen2022-02-111-32/+39
|\ \ | |/
| * Do not drop rest data for send timeoutRaimo Niskanen2022-01-311-32/+39
| |
* | Fix typos in lib/kernelKian-Meng, Ang2021-12-231-1/+1
|/ | | | Co-authored-by: Björn Gustavsson <bgustavsson@gmail.com>
* Merge pull request #5348 from ↵Raimo Niskanen2021-11-231-4/+9
|\ | | | | | | | | hauleth/fix/do-not-bind-on-fd-with-undefined-ifaddr OTP-17793: Do not bind on FD with undefined ifaddr
| * fix: do not bind on FD with undefined ifaddrŁukasz Niemier2021-11-101-4/+9
| | | | | | | | | | | | | | | | | | This is behaviour exposed by the `inet` backend and also the expected behaviour, as it allows to use `socket` backend together with systemd socket activation where the application receives bound socket with messages already in queue. Close #4680
* | [kernel] Make inet:socknames/1 handle new 'new' socketsMicael Karlberg2021-10-181-0/+13
|/ | | | | | | | | | Make inet:socknames/1 handle 'new' (socket) sockets. inet:socknames/1 for TCP and UDP are a simple wrapper for sockname/1. And since we have not yet implemented support for sctp in socket, that (socknames-) problem, is not yet solvet. OTP-17531
* Merge branch ↵Raimo Niskanen2021-09-021-340/+350
|\ | | | | | | | | | | | | | | | | | | 'raimo/kernel/inet-backend-socket-option-parsing/GH-5122/OTP-17580' into maint * raimo/kernel/inet-backend-socket-option-parsing/GH-5122/OTP-17580: Further simplify option parsing Comment out currently dead code due to Dialyzer Fix tests for inet_backend = socket Rewrite option parsing to less messy
| * Further simplify option parsingRaimo Niskanen2021-08-311-131/+57
| | | | | | | | | | | | | | | | | | Use list comprehensions instead of hand crafted non-standard but maybe more optimized functions. Optimize later if needed. Also, change how the protocol name is chosen: Use 'tcp' for domains 'inet' and 'inet6', otherwise 'default', which should correspond to what we know about these protocol domains.
| * Comment out currently dead code due to DialyzerRaimo Niskanen2021-08-261-2/+2
| |
| * Rewrite option parsing to less messyRaimo Niskanen2021-08-251-322/+406
| |
* | [kernel|gen-tcp-socket] Misc tweakingMicael Karlberg2021-08-301-20/+46
|/ | | | | | | | Many of the changes here will be "fixed" in a specific branch, but some of the tweaks will only occur here. OTP-17156 OTP-17533
* [kernel] Add 'active' to infoMicael Karlberg2021-07-291-2/+2
| | | | | | | Add 'active' to info for gen_tcp_socket and the old 'port' socket's. OTP-17410
* [kernel|gen-tcp-socket] Extend handling of call-exceptionsMicael Karlberg2021-07-271-1/+16
| | | | | | | Extend the number of 'exception's we explicitly "take care of" in the call function. OTP-17156
* [kernel|gen-tcp-socket] Handle buffered data when activatingMicael Karlberg2021-07-231-5/+101
| | | | | | | | | | | | | If the socket is deactivated; active: once | true | N > 0 -> false we do not cancel any select! Data that arrive during the phase when we are in state 'recv' but are inactive is simply stored in the buffer. Then if activated: active: false -> once | true | N > 0, we need to check if there is something in our buffers, and maybe deliver it to its owner. This should only occure if we are in state connected (state 'recv' and in-active when data arrives => put data in buffer and then enter state 'connected', since we are in-active). OTP-17156
* [kernel|gen-tcp-socket] Tweak bindMicael Karlberg2021-07-231-12/+15
| | | | | | | | | It should be possible to bind to a port, but not address. That is if you provide a port number but no address when creating a socket (connect or listen). This case should be mapped to #{port => Port, addr => any}. OTP-17156
* [kernel] Improve inet:info/1Micael Karlberg2021-06-151-2/+10
| | | | | | | | | | | | | The info function did not handle a closed socket well. A 'closed' socket is represented by a info map with *only* the one or two states-attributes, with the value(s) set to [closed]. Also if the function is called for a non-socket port, behave as well as possible (no status or statistics). OTP-17492 [kernel] More tweaking
* Implement undocumented functionsRaimo Niskanen2021-05-271-14/+89
|
* Improve handling of when to bindRaimo Niskanen2021-05-271-3/+1
|
* Improve handling of when to bindRaimo Niskanen2021-05-271-15/+11
|
* Merge branch 'raimo/sendfile/OTP-17154'Raimo Niskanen2021-05-061-7/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | * raimo/sendfile/OTP-17154: Block enif_make_resource in destructor Check caller for cancel Bugfix: clean up state for connect cancel Fix sendfile bug: offset update on FreeBSD and Solaris Improve diagnostics Polish the documentation Fix select clauses Write tests for socket:sendfile Improve test case diagnostics Use the right debug printout
| * Fix select clausesRaimo Niskanen2021-04-281-7/+9
| |
* | Handle not binding in bind_addr() and extra_opts()Raimo Niskanen2021-05-031-53/+43
| |
* | fix: use better check for passed FDŁukasz Niemier2021-05-031-4/+4
| |
* | fix(kernel): do not bind sockets created from FDsŁukasz Niemier2021-04-301-2/+8
| | | | | | | | | | | | | | | | | | | | These sockets should be already bound for us, otherwise it is pointless to pass them. In the end we are (almost) always able to create sockets on our own (while we can not be able to bind it to some values). This will check if socket is created form existing FD, and if so, it will silently skip bind, assuming that it is already bound. Fix #4680
* | Merge branch 'bmk/kernel/20210426/inet_i_gen_tcp_socket/OTP-17157'Micael Karlberg2021-04-301-4/+40
|\ \ | | | | | | | | | OTP-17157
| * | [kernel] Fixed a dialyzer issueMicael Karlberg2021-04-281-7/+3
| | | | | | | | | | | | | | | | | | | | | Info returned by socket:info/1 *does* contain 'owner' (no need for a case clause... OTP-17157
| * | [kernel] inet:i/0 now also reports tcp compat socketsMicael Karlberg2021-04-281-4/+44
| | | | | | | | | | | | OTP-17157
* | | Merge branch 'bmk/kernel/20210426/socket_monitor/OTP-17155'Micael Karlberg2021-04-301-6/+41
|\ \ \ | |/ / | | / | |/ |/| OTP-17155
| * [kernel] Rebase correctionMicael Karlberg2021-04-261-3/+3
| | | | | | | | OTP-17155
| * [kernel] Add some utility functions (prep for observer).Micael Karlberg2021-04-261-2/+13
| | | | | | | | | | | | | | | | | | Add a couple of utility functions, soch as listing monitors for a socket och which processes has monitored a socket. Also add utility function to convert a socket to a string (to_list/1) comparable to erlang:port_to_list/1. OTP-17155
| * [kernel] Socket monitor renamingsMicael Karlberg2021-04-261-7/+4
| | | | | | | | | | | | | | | | | | | | The function [inet|socket]:demonitor/1 was renamed to [inet|socket]:cancel_monitor/1. Also removed [inet|socket]:demonitor/2. It fould not safely perform the flush feature and the info feature could just as well *always* be done by the /1 function. OTP-17155
| * [esock] Document, refresh and test socmet monitorMicael Karlberg2021-04-261-19/+10
| | | | | | | | | | | | | | Add documentation, (more) test cases and also some interface restructure. OTP-17155
| * [esock] Attempt to monitor unknown socket (now) failsMicael Karlberg2021-04-261-1/+6
| | | | | | | | | | | | | | | | Attempt to monitor a nonexisting (gen-tcp-socket) socket now fails (erlang:error/1). Also add two more test cases. OTP-17155
| * [esock] Add general socket monitoringMicael Karlberg2021-04-261-5/+24
| | | | | | | | | | | | | | | | Add general socket monitor feature. That is, make it possible to monitor "classic" sockets (port) as well as new gen_tcp_socket sockets. OTP-17155