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; }