Handle T action with chunked transfer correctly

This commit is contained in:
Kovid Goyal 2017-10-03 20:34:48 +05:30
parent c87dcdbe3c
commit acc43ce9dc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 3 additions and 1 deletions

View File

@ -320,6 +320,7 @@ handle_add_command(GraphicsManager *self, const GraphicsCommand *g, const uint8_
if (tt == 'd' && self->loading_image) init_img = false; if (tt == 'd' && self->loading_image) init_img = false;
if (init_img) { if (init_img) {
self->loading_image = 0; self->loading_image = 0;
self->last_init_img_action = g->action;
if (g->data_width > 10000 || g->data_height > 10000) ABRT(EINVAL, "Image too large"); if (g->data_width > 10000 || g->data_height > 10000) ABRT(EINVAL, "Image too large");
remove_images(self, add_trim_predicate); remove_images(self, add_trim_predicate);
img = find_or_create_image(self, g->id, &existing); img = find_or_create_image(self, g->id, &existing);
@ -602,7 +603,7 @@ grman_handle_command(GraphicsManager *self, const GraphicsCommand *g, const uint
case 'T': case 'T':
image = handle_add_command(self, g, payload, is_dirty); image = handle_add_command(self, g, payload, is_dirty);
ret = create_add_response(self, g, image != NULL); ret = create_add_response(self, g, image != NULL);
if (g->action == 'T') handle_put_command(self, g, c, is_dirty, image); if (self->last_init_img_action == 'T') handle_put_command(self, g, c, is_dirty, image);
break; break;
case 'p': case 'p':
if (!g->id) { if (!g->id) {

View File

@ -64,6 +64,7 @@ typedef struct {
index_type lines, columns; index_type lines, columns;
size_t image_count, images_capacity, loading_image; size_t image_count, images_capacity, loading_image;
char last_init_img_action;
Image *images; Image *images;
size_t count, capacity, rp_capacity; size_t count, capacity, rp_capacity;
ImageRenderData *render_data; ImageRenderData *render_data;