diff --git a/src/server.c b/src/server.c index 9d226f9..bc2da9f 100644 --- a/src/server.c +++ b/src/server.c @@ -661,7 +661,9 @@ static void process_fb_update_requests(struct nvnc_client* client) client->encoder->on_done = on_encode_frame_done; client->encoder->userdata = client; - if (encoder_encode(client->encoder, fb, &damage) < 0) { + if (encoder_encode(client->encoder, fb, &damage) >= 0) { + --client->n_pending_requests; + } else { log_error("Failed to encode current frame"); client_unref(client); client->is_updating = false; @@ -1347,8 +1349,6 @@ static void finish_fb_update(struct nvnc_client* client, struct rcbuf* payload, client_unref(client); } - client->n_pending_requests--; - DTRACE_PROBE1(neatvnc, update_fb_done, client); }