From cc9c70373ee54a1faa981a6676d28c59245ddff9 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 14 Dec 2015 10:05:00 +1100 Subject: [PATCH] Send diff first when when sending the first stratum template after subscribing --- src/stratifier.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/stratifier.c b/src/stratifier.c index 25f654ab..bda12d4c 100644 --- a/src/stratifier.c +++ b/src/stratifier.c @@ -3534,6 +3534,13 @@ static void suggest_diff(stratum_instance_t *client, const char *method, const j stratum_send_diff(sdata, client); } +/* Send diff first when sending the first stratum template after subscribing */ +static void init_client(sdata_t *sdata, const stratum_instance_t *client, const int64_t client_id) +{ + stratum_send_diff(sdata, client); + stratum_send_update(sdata, client_id, true); +} + /* Enter with client holding ref count */ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64_t client_id, json_t *id_val, json_t *method_val, json_t *params_val) @@ -3572,7 +3579,7 @@ static void parse_method(sdata_t *sdata, stratum_instance_t *client, const int64 json_object_set_new_nocheck(val, "error", json_null()); stratum_add_send(sdata, val, client_id); if (likely(client->subscribed)) - update_client(sdata, client, client_id); + init_client(sdata, client, client_id); return; }