Skip to content

Commit 3bc578b

Browse files
committed
Update sockhub
1 parent c2f2769 commit 3bc578b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/pg_xtm/sockhub/sockhub.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ void ShubLoop(Shub* shub)
246246
ShubMessageHdr* hdr = (ShubMessageHdr*)(shub->out_buffer + pos);
247247
int chan = hdr->chan;
248248
n = pos + sizeof(ShubMessageHdr) + hdr->size <= shub->out_buffer_used ? hdr->size + sizeof(ShubMessageHdr) : shub->out_buffer_used - pos;
249-
pos += sizeof(ShubMessageHdr);
250249
if (!write_socket(chan, (char*)hdr, n)) {
251250
shub->params->error_handler("Failed to write to local socket", SHUB_RECOVERABLE_ERROR);
252251
close_socket(shub, chan);
@@ -269,9 +268,11 @@ void ShubLoop(Shub* shub)
269268
}
270269
tail -= n;
271270
} while (tail != 0);
271+
272272
pos = shub->out_buffer_used;
273273
break;
274274
}
275+
pos += n;
275276
}
276277
memcpy(shub->out_buffer, shub->out_buffer + pos, shub->out_buffer_used - pos);
277278
shub->out_buffer_used -= pos;

0 commit comments

Comments
 (0)