diff options
author | Micael Karlberg <[email protected]> | 2018-11-01 18:30:09 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2018-11-01 18:30:09 +0100 |
commit | 0c6a8375990e491405e2282e5e038d384727f1e2 (patch) | |
tree | 64ebb2dc1f131ddb94dc98ab828cea82695d17b7 /erts/emulator/nifs | |
parent | 3f46e8a184a503ead01674ee180e7222b3928712 (diff) | |
download | otp-0c6a8375990e491405e2282e5e038d384727f1e2.tar.gz otp-0c6a8375990e491405e2282e5e038d384727f1e2.tar.bz2 otp-0c6a8375990e491405e2282e5e038d384727f1e2.zip |
[sock-nif|test] Add a ping-pong test case
We got some kind of send hang...
Diffstat (limited to 'erts/emulator/nifs')
-rw-r--r-- | erts/emulator/nifs/common/socket_nif.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/erts/emulator/nifs/common/socket_nif.c b/erts/emulator/nifs/common/socket_nif.c index 27395b5cf6..389d43ee42 100644 --- a/erts/emulator/nifs/common/socket_nif.c +++ b/erts/emulator/nifs/common/socket_nif.c @@ -13314,12 +13314,6 @@ ERL_NIF_TERM send_check_result(ErlNifEnv* env, SSDBG( descP, ("SOCKET", "send_check_result -> try again\r\n") ); - /* <KOLLA> - * SHOULD RESULT IN {error, eagain}!!!! - * </KOLLA> - */ - written = 0; - } } @@ -13349,7 +13343,8 @@ ERL_NIF_TERM send_check_result(ErlNifEnv* env, descP, NULL, sendRef); SSDBG( descP, - ("SOCKET", "send_check_result -> not entire package written\r\n") ); + ("SOCKET", "send_check_result -> " + "not entire package written (%d of %d)\r\n", written, dataSize) ); return esock_make_ok2(env, MKI(env, written)); @@ -13687,15 +13682,26 @@ ERL_NIF_TERM recv_check_result(ErlNifEnv* env, } else if ((saveErrno == ERRNO_BLOCK) || (saveErrno == EAGAIN)) { + int sres; + SSDBG( descP, ("SOCKET", "recv_check_result -> [%d] eagain\r\n", toRead) ); if ((xres = recv_init_current_reader(env, descP, recvRef)) != NULL) return esock_make_error_str(env, xres); + SSDBG( descP, ("SOCKET", "recv_check_result -> SELECT for more\r\n") ); + + /* SELECT(env, descP->sock, (ERL_NIF_SELECT_READ), descP, NULL, recvRef); + */ + sres = enif_select(env, descP->sock, (ERL_NIF_SELECT_READ), + descP, NULL, recvRef); + + SSDBG( descP, ("SOCKET", "recv_check_result -> SELECT res: %d\r\n", sres) ); + return esock_make_error(env, esock_atom_eagain); } else { ERL_NIF_TERM res = esock_make_error_errno(env, saveErrno); |