diff options
author | Micael Karlberg <[email protected]> | 2018-11-02 14:14:48 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-11-02 14:14:48 +0100 |
commit | d0df643ad994bbc609c52f83b814fc79624af501 (patch) | |
tree | e296977feee6d9c2e4b6b80166f62bd2507fc2a6 /erts/emulator/nifs | |
parent | 0c6a8375990e491405e2282e5e038d384727f1e2 (diff) | |
download | otp-d0df643ad994bbc609c52f83b814fc79624af501.tar.gz otp-d0df643ad994bbc609c52f83b814fc79624af501.tar.bz2 otp-d0df643ad994bbc609c52f83b814fc79624af501.zip |
[socket-nif] Inherit buffer sizes when accepting
An "accepted" socket will inherit the parent (listen) socket's
buffer sizes (rBufSz, rCtrlSz and wCtrlSz).
OTP-14831
Diffstat (limited to 'erts/emulator/nifs')
-rw-r--r-- | erts/emulator/nifs/common/socket_nif.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index 389d43ee42..82bf8305fc 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -4919,6 +4919,9 @@ ERL_NIF_TERM naccept_listening(ErlNifEnv* env, accDescP->domain = descP->domain; accDescP->type = descP->type; accDescP->protocol = descP->protocol; + accDescP->rBufSz = descP->rBufSz; // Inherit buffer size + accDescP->rCtrlSz = descP->rCtrlSz; // Inherit buffer siez + accDescP->wCtrlSz = descP->wCtrlSz; // Inherit buffer size accRef = enif_make_resource(env, accDescP); enif_release_resource(accDescP); // We should really store a reference ... @@ -9549,7 +9552,17 @@ ERL_NIF_TERM nsetopt_int_opt(ErlNifEnv* env, int val; if (GET_INT(env, eVal, &val)) { - int res = socket_setopt(descP->sock, level, opt, &val, sizeof(val)); + int res; + + /* + SSDBG( descP, + ("SOCKET", "nsetopt_int_opt -> set option" + "\r\n opt: %d" + "\r\n val: %d" + "\r\n", opt, val) ); + */ + + res = socket_setopt(descP->sock, level, opt, &val, sizeof(val)); if (res != 0) result = esock_make_error_errno(env, sock_errno()); |