Commit 553db656 authored by rinpatch's avatar rinpatch

Wrap cnode responses into {:myhtml_worker, resp} tuples

This will allow us to receive messages without the need to spawn a new
process in the future
parent 9591bfde
......@@ -395,6 +395,8 @@ static void build_tree (ei_x_buff * response, myhtml_tree_t * tree, myhtml_tree_
// ok we're going to send an actual response so start encoding it
response->index = 0;
ei_x_encode_version (response);
ei_x_encode_tuple_header(response, 2);
ei_x_encode_atom(response, "myhtml_worker");
while (current_node != NULL)
{
......@@ -447,7 +449,7 @@ static void build_tree (ei_x_buff * response, myhtml_tree_t * tree, myhtml_tree_
strncpy (tag_string, tag_name, sizeof buffer - 1);
}
if (response->index > 1)
if (stack.used > 0)
{
EMIT_LIST_HDR;
}
......
......@@ -96,7 +96,7 @@ defmodule :fast_html do
"""
@spec decode(String.t(), format: [format_flag()]) :: tree()
def decode(bin, format: flags) do
{:ok, res} = Nodex.Cnode.call(FastHtml.Cnode, {:decode, bin, flags})
{:ok, {:myhtml_worker, res}} = Nodex.Cnode.call(FastHtml.Cnode, {:decode, bin, flags})
res
end
end
......@@ -57,8 +57,8 @@ defmodule FastHtml.Application do
defp start_epmd(path) do
case System.cmd(path, ["-daemon"]) do
{_, 0} -> :ok
{_, exit_code} -> {:error, "Could not start epmd, exit code: #{exit_code}"}
{_result, 0} -> :ok
{_result, exit_code} -> {:error, "Could not start epmd, exit code: #{exit_code}"}
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment