diff options
Diffstat (limited to 'src/plop.erl')
-rw-r--r-- | src/plop.erl | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/plop.erl b/src/plop.erl index 6e15781..0523613 100644 --- a/src/plop.erl +++ b/src/plop.erl @@ -110,7 +110,7 @@ handle_cast(_Request, State) -> handle_http_reply(State, {storage_sendentry_http, {OwnRequestId}}, StatusCode, Body) -> lager:debug("http_reply: ~p", [Body]), - {PropList} = (catch jiffy:decode(Body)), + {struct, PropList} = mochijson2:decode(Body), Result = proplists:get_value(<<"result">>, PropList), case dict:fetch(OwnRequestId, State#state.own_requests) of undefined -> @@ -197,23 +197,24 @@ storage_nodes_quorum() -> Value. send_storage_sendentry(URLBase, LogEntry, TreeLeafHash) -> - Request = jiffy:encode( + Request = mochijson2:encode( {[{plop_version, 1}, {entry, base64:encode(LogEntry)}, {treeleafhash, base64:encode(TreeLeafHash)} ]}), + lager:debug("send sendentry to storage node ~p: ~p", [URLBase, Request]), httpc:request(post, {URLBase ++ "sendentry", [], - "text/json", Request}, + "text/json", list_to_binary(Request)}, [], [{sync, false}]). send_storage_entrycommitted(URLBase, EntryHash, TreeLeafHash) -> - Request = jiffy:encode( - {[{plop_version, 1}, - {entryhash, base64:encode(EntryHash)}, - {treeleafhash, base64:encode(TreeLeafHash)} - ]}), + Request = mochijson2:encode( + {[{plop_version, 1}, + {entryhash, base64:encode(EntryHash)}, + {treeleafhash, base64:encode(TreeLeafHash)} + ]}), httpc:request(post, {URLBase ++ "entrycommitted", [], - "text/json", Request}, + "text/json", list_to_binary(Request)}, [], [{sync, false}]). store_at_all_nodes(Nodes, {LogEntry, TreeLeafHash, EntryHash}, From, State) -> |