This commit is contained in:
2025-11-08 02:43:41 +01:00
parent 463b1b4ba9
commit 279777fc8b
4 changed files with 22 additions and 9 deletions
+4 -2
View File
@@ -76,8 +76,8 @@ static void append_hex_as_str(char *out, SHA256 hash)
{
char table[] = "0123456789abcdef";
for (int i = 0; i < (int) sizeof(hash); i++) {
out[(i << 1) + 0] = table[hash.data[i] >> 4];
out[(i << 1) + 1] = table[hash.data[i] & 0xF];
out[(i << 1) + 0] = table[(uint8_t) hash.data[i] >> 4];
out[(i << 1) + 1] = table[(uint8_t) hash.data[i] & 0xF];
}
}
@@ -699,6 +699,8 @@ process_client_upload_chunk(ChunkServer *state, int conn_idx, ByteView msg)
ByteQueue *output = tcp_output_buffer(&state->tcp, conn_idx);
message_writer_init(&writer, output, MESSAGE_TYPE_UPLOAD_CHUNK_SUCCESS);
message_write(&writer, &new_hash, sizeof(new_hash));
if (!message_writer_free(&writer))
return -1;
return 0;