Permalink
Browse files

Return eagain when no data is available

Previously when calling recvfrom/2 would return the atom "nodata" when
errno == EAGAIN.
  • Loading branch information...
1 parent 560517c commit 61cffdaed2f48b7b4c8a957a3cd050e4614b5fa9 @msantos committed Dec 15, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 c_src/procket.c
View
@@ -40,15 +40,15 @@ static ERL_NIF_TERM error_tuple(ErlNifEnv *env, int errnum);
static ERL_NIF_TERM atom_ok;
static ERL_NIF_TERM atom_error;
-static ERL_NIF_TERM atom_nodata;
+static ERL_NIF_TERM atom_eagain;
static int
load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
{
atom_ok = enif_make_atom(env, "ok");
atom_error = enif_make_atom(env, "error");
- atom_nodata = enif_make_atom(env, "nodata");
+ atom_eagain = enif_make_atom(env, "eagain");
return (0);
}
@@ -214,7 +214,7 @@ nif_recvfrom(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
case EAGAIN:
case EINTR:
enif_release_binary(&buf);
- return atom_nodata;
+ return atom_eagain;
default:
enif_release_binary(&buf);
return error_tuple(env, errno);

0 comments on commit 61cffda

Please sign in to comment.