So I made some improvements to the networking API as suggested by Jester:ListenOnPort() now takes an optional second parameter, max_backlog. If not provided, it defaults to zero, which causes the socket to behave as in Sphere 1.5
static js_retval_tjs_CreateColor(_JS_C_FUNC_ARGS_){ js_begin_api_func("CreateColor"); js_require_num_args(3); js_int_arg(1, r_val); js_int_arg(2, g_val); js_int_arg(3, b_val); js_maybe_int_arg(4, a_val, 255); r_val = fmin(fmax(r_val, 0), 255); g_val = fmin(fmax(g_val, 0), 255); b_val = fmin(fmax(b_val, 0), 255); a_val = fmin(fmax(a_val, 0), 255); js_return_sphereobj(color, al_map_rgba(r_val, g_val, b_val, a_val));}
Oh, and NEO: After a few necessary minor edits to the code, your Artyxx demo works great in minisphere.
Quote from: Lord English on March 19, 2015, 03:22:18 pmOh, and NEO: After a few necessary minor edits to the code, your Artyxx demo works great in minisphere. Groovy! Can you PR those edits to the repo?
That makes no sense because Sphere 1.5 has no accept() method for listeners and (from what I can tell) the listening socket closes as soon as someone connects to it, at which point the object becomes (i.e. is internally mutated into) a normal bidirectional socket. Sphere might set a backlog of 16 internally, but the way the API is exposed, it effectively can only accept a single connection. Hence the zero default in minisphere to specify the legacy behavior.
Quote from: Lord English on March 20, 2015, 09:26:07 pmThat makes no sense because Sphere 1.5 has no accept() method for listeners and (from what I can tell) the listening socket closes as soon as someone connects to it, at which point the object becomes (i.e. is internally mutated into) a normal bidirectional socket. Sphere might set a backlog of 16 internally, but the way the API is exposed, it effectively can only accept a single connection. Hence the zero default in minisphere to specify the legacy behavior.That's not what that number means. Setting that number to zero in Linux or BSD will result in no connections whatsoever being accepted. If any are accepted with winsock, that is a bug in winsock or a misinterpretation of the BSD API. Setting that number sets the number of connections that can exist waiting on listening socket, waiting for an Accept. Setting it to zero means that there can be zero sockets ready to be accepted, the queue has a size of zero and will always be empty.Setting it to one is much more correct.