Age | Commit message (Collapse) | Author |
|
Make use of the new select functions; enif_select_[read|write],
for read and write select. These functions allows us to construct
the select message ourseves:
{'$socket', Socket, select, Ref}
This is in preparations for when we introduce the 'nowait'
(or something similar) value for the timeout argument (in accept,
read and write funcions).
It also solves (we hope) the term leakage problems (it was difficult
to free the environment when there was only one/socket).
OTP-15496
|
|
Firstly, make sure socket (and own) options manipulations
are safe by adding a mutex that we take in the setopt and
getopt functions.
Secondly, change type prefix of various types from
'Socket' to 'ESock' (for instance; SocketDescriptor ->
ESockDescriptor).
OTP-15496
|
|
To increase readability the close function has been slightly
restructured.
|
|
To increase readability the recvmsg result check has been slightly
restructured. In this case we made use of the error case function
(fail) of the recv result check.
|
|
To increase readability the recvfrom result check has been slightly
restructured. In this case we made use pf the error case function
(fail) of the recv result check.
|
|
To increase readability the recv result check has been slightly
restructured.
|
|
To increase readability the send result check has been slightly
restructured.
|
|
The messages sent from the nif code to an erlang process
has been changed to:
{'$socket', Socket :: socket(), Tag :: atom(), Info :: term()}
This is in preparation for (using) the new enif select API.
OTP-15496
|
|
Used ref from wrong environment when building reply.
|
|
* john/erts/unc-path-size-fix/OTP-15693:
erts: Fix incorrect UNC path length calculation
|
|
This didn't cause any issues for the most part since the path was
still properly formed, but it broke down when appending the
wildcards in file:list_dir/1. The ASSERT_PATH_FORMAT macro would
have caught this in no time, but it went unnoticed because we don't
run debug builds on Windows.
|
|
|
|
|
|
During socket stop the close environment somehow has
been NULLed. Check this before using when sending the
close message.
|
|
We use clock_gettime(CLOCK_REALTIME, ...) to create a simple
timestamp. This is used both for debugging and when writing
error/warning messages (from the nif-code).
The workaround for the absence of this function (on some platforms,
old versions of darwin for example) is to simply skip the timestamp.
|
|
|
|
|
|
Fixed an issue (I think) that during socket close
could cause a core.
|
|
Fixed a memory leak in the function for address infos encoding.
|
|
A debug printout in the socket_stop fucntion used the wrong
requestor record for the pid, which may leasd to a confusing
debug printout.
|
|
The activate-next (reader|writer|acceptor) always
*incorrectly* used the read select function.
This has now been changed so that the functions
are created via a macro with an argument specifying
which select function to use.
|
|
|
|
Replace the won function for pid compare with the
(new) enif_compare_pids function.
OTP-15565
|
|
Add some more comments in order to increase readability.
OTP-15565
|
|
Implemented the activate_next function and added its
"users" acceptor, writer and reader (macro abuse).
After a request (accept, write or send) has been either
successfully completed or failed, another request should
be activated. Previously only one attempt was made, which
might leave the other (waiting) requestors hanging.
Now, instead we use a 'activate-next' function that pop's
the request (accept, wrote or read) queue until success
or its empty, thereby making sure that no waiting processes
is left hanging.
OTP-15565
|
|
Remove own function to make monitor printable (was a hack)
and make use of the new enif_make_monitor_term instead.
|
|
bmk/20190301/cleanup_through_macro_abuse/OTP-15565
|
|
Fixed some type size warnings (SCTP related). E.g:
On Solaris 11 (OpenIndiana Hipster) long and int is size 4,
but the way Sint32 def works it first "tests" for long size and
if that is correct, that is chosen (which it is on Solaris 11).
On linux long is size 8, so Sint32 will be defined as int.
...
On Solaris 11 the flags TCP_CONGESTION and SO_BINDTODEVICE
does not exist, so the function(s) n[set|get]opt_str_opt is never
used. So, in order to keep the compiler quiet, we add some if-def
to exclude these functions in this case.
|
|
|
|
The requestor (acceptor, writer and reader) functions are
virtually identical, so to ensure quality and not having
to write the exact same functions three times, we make
use of some macro magic for their declaration.
OTP-15565
|
|
Some more macro abuse for nif API callback functions.
OTP-15565
|
|
Some more macro abuse for nif API callback functions and
the operator (acceptor, writer and reader) queue wrapper functions
(search4pid, push, pop and unqueue).
OTP-15565
|
|
|
|
Make use of macro concat magic to simplify declarations.
OTP-15565
|
|
The getnameinfo function has been fixed:
1) Faulty sockaddr decode success check
2) Incorrect (name info) return value
OTP-15636
|
|
Some cleanup (of open, bind, connect) and rewrote the
accept code (moved the code into smaller functions).
OTP-14831
|
|
Better handling of socket close. The 'closeRef' needed
its own environment to make if work in both cases (both
called and scheduled).
Also Introduced the enif select wrapper functions (read,
write, stop and cancel). Also add error handling at every
time one of these functions are called.
OTP-14831
|
|
Fixed a raise condition bug in the socket_stop (callback)
function that could result in the socket actually *not*
beeing closed.
OTP-14831
|
|
Assert failed in enif_demonitor when called with "NULL-monitor".
Replaced null monitor with separate 'is_active' boolean
and added my_make_monitor_term for printing (to be replaced
with enif_make_monitor_term).
|
|
Asserts failed in debug vm as msg term was built
from mixed ErlNifEnv's.
|
|
and collapsed some duplicate code
|
|
|
|
as called in crypto.erl and erlang.erl.
|
|
bmk/20190204/socket_as_nif/OTP-14831
|
|
The nif callback functions (nif_open) now instead cause an
'nosup' exception if called (instead of badarg).
The basic type uint16_t, uint32_t and int32_t (C99) replaced
"own" (that is, defined by "us") types Uint16, Uint32 and
Sint32.
The point of this is that our Windows build system seems to
be a bit lacking when it comes to types...
Removed "some stuff" that was if-defed. Different solution
when win32 support for sockets has been improved.
Make sure the socket_*.c util modules are not included
in the building for windows.
OTP-15526
|
|
Added preliminary, and temporary, windows adaptions.
Basically they amount to letting all nif-callback functions
returning badarg for all calls if on windows (this has
been accomplished by if-defing the nif-code; if win32 then
badarg else do-something).
OTP-15526
|
|
Its now possible to set a rcvbuf (otp) option value
of {N :: pos_integer(), BufSz :: pos_integer()}.
This value is used for type stream and protocol tcp,
when calling the function recv with length = 0 (zero).
The second value, BufSz, is the actual size of the receive
buffer used when calling the socket recv function, and
the first value, N, is the max number of possible reads
that will be performed (at most), even if there is more
data to read. This is limit the effect of DoS attacks.
OTP-15497
|
|
The read and write functions now *only* use the isReadable and
isWritable fields, respectively, to decide if the "socket" can be read
from and written to (previously the state field was used outside of
the mutex lock).
Also made it possible to enable / disable test suite groups individually,
via environment variables (ESOCK_TEST_...). Specifically, the ttest
group has been excluded by default (takes to long a time).
OTP-15549
|
|
Add a way to *get* the file descriptor (fd) of a socket.
Useful mostly for debugging.
OTP-15528
|
|
* maint:
Remove an unused variable
Spawn prim_file helper as a system process
|