Basic rsync transmission works

This commit is contained in:
Kovid Goyal
2023-07-20 14:35:18 +05:30
parent f305b03897
commit aa3d986251
2 changed files with 22 additions and 10 deletions

View File

@@ -260,7 +260,7 @@ sign_block(Patcher *self, PyObject *args) {
return PyLong_FromSize_t(signature_block_size);
}
typedef enum { OpBlock, OpBlockRange, OpHash, OpData } OpType;
typedef enum { OpBlock, OpData, OpHash, OpBlockRange } OpType;
typedef struct Operation {
OpType type;
@@ -268,6 +268,8 @@ typedef struct Operation {
struct { uint8_t *buf; size_t len; } data;
} Operation;
#define bytes_as_hex_for_debug(data, len) PyUnicode_AsUTF8(PyObject_CallMethod(PyBytes_FromStringAndSize((char*)data, len), "hex", NULL))
static size_t
unserialize_op(uint8_t *data, size_t len, Operation *op) {
size_t consumed = 0;