Wow, I fixed it with two characters!

!,

Now that's powerful voodo!

I am not sure why it has worked exactly though. The memory used and free
values do not change at all now which is fantastic as it means every page
impression leaves the system in the same state regarding memory usage which
is brilliant news.  Here is the solution:

http_server_loop(S, Callback) :-
socket_accept(S, _Client, In, Out),
logger_info("Accepted connection: ~w", [_Client]),
set_stream_type(In, binary),
set_stream_buffering(In, none),
set_stream_type(Out, binary),
%%
http_server_get_request(In, Request),
Handler =.. [Callback, Out, Request],
call(Handler),
* !,    %%% <==== here is the fix!*
%% keep_alive?
close(In),
close(Out),
http_server_loop(S, Callback).

I was going to colour it green but is it a green cut or a red cut? Either
way it's bloody magic!! :)

I can take it out and put it back now and try to understand the full
enormity of what I have done! LMAO   I am guessing that the cut has caused
all variables currently bound with values to be discarded or something like
that.

Thanks, any expansions on my twisted reasoning are still most welcome!

Sean.
_______________________________________________
Users-prolog mailing list
Users-prolog@gnu.org
https://lists.gnu.org/mailman/listinfo/users-prolog

Reply via email to