feat: 对接Python,暴露接口
This commit is contained in:
@@ -53,6 +53,15 @@ static void *kcppeer_receive_thread_main(void *arg) {
|
||||
}
|
||||
fprintf(stderr, "received file from %s to %s: %s (%lu bytes) -> %s\n", msg.from, msg.to, msg.file_name, (unsigned long) msg.body_len, persisted_path);
|
||||
break;
|
||||
case MSG_TYPE_BINARY:
|
||||
if (kcp_client_persist_message(ctx->client, &msg, ctx->inbox_dir, persisted_path, sizeof(persisted_path)) != 0) {
|
||||
fprintf(stderr, "kcppeer: persist binary payload from %s to %s failed\n", msg.from, msg.to);
|
||||
protocol_message_clear(&msg);
|
||||
ctx->rc = -1;
|
||||
return NULL;
|
||||
}
|
||||
fprintf(stderr, "received binary payload from %s to %s (%lu bytes) -> %s\n", msg.from, msg.to, (unsigned long) msg.body_len, persisted_path);
|
||||
break;
|
||||
case MSG_TYPE_ERROR:
|
||||
fprintf(stderr, "received error from %s to %s: %.*s\n", msg.from, msg.to, (int) msg.body_len, msg.body == NULL ? "" : (const char *) msg.body);
|
||||
break;
|
||||
|
||||
@@ -50,6 +50,15 @@ static void *udppeer_receive_thread_main(void *arg) {
|
||||
}
|
||||
fprintf(stderr, "received file from %s to %s: %s (%lu bytes) -> %s\n", msg.from, msg.to, msg.file_name, (unsigned long) msg.body_len, persisted_path);
|
||||
break;
|
||||
case MSG_TYPE_BINARY:
|
||||
if (udp_client_persist_message(ctx->client, &msg, ctx->inbox_dir, persisted_path, sizeof(persisted_path)) != 0) {
|
||||
fprintf(stderr, "udppeer: persist binary payload from %s to %s failed\n", msg.from, msg.to);
|
||||
protocol_message_clear(&msg);
|
||||
ctx->rc = -1;
|
||||
return NULL;
|
||||
}
|
||||
fprintf(stderr, "received binary payload from %s to %s (%lu bytes) -> %s\n", msg.from, msg.to, (unsigned long) msg.body_len, persisted_path);
|
||||
break;
|
||||
case MSG_TYPE_ERROR:
|
||||
fprintf(stderr, "received error from %s to %s: %.*s\n", msg.from, msg.to, (int) msg.body_len, msg.body == NULL ? "" : (const char *) msg.body);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user