Fix pc/pm

Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
方而静 2024-02-08 17:57:47 +08:00
parent 45b67a2274
commit fef044743b
Signed by: szTom
GPG Key ID: 072D999D60C6473C
2 changed files with 15 additions and 6 deletions

View File

@ -2,6 +2,17 @@
ProcedureManager::ProcedureManager() {}
struct ProcedureCallHeader {
uint64_t rd;
int32_t method;
uint32_t len;
};
struct ProcedureReturnHeader {
uint64_t rd;
uint32_t len;
};
void ProcedureManager::handleCall(FILE *in, FILE *out) const {
ProcedureCallHeader header;
auto ptr = reinterpret_cast<byte*>(&header);
@ -18,6 +29,10 @@ void ProcedureManager::handleCall(FILE *in, FILE *out) const {
delete[] buf;
if (procedures.count(header.method)) {
auto res = procedures.at(header.method)(bb);
ProcedureReturnHeader rh;
rh.rd = header.rd;
rh.len = header.len;
fwrite(&rh, 1, sizeof(rh), out);
res.writeTo(out);
}
}

View File

@ -31,12 +31,6 @@ struct FuncArgTraits<ReturnType(ClassType::*)(Args...) const> {
using type = std::tuple<Args...>;
};
struct ProcedureCallHeader {
uint64_t rd;
int32_t method;
uint32_t len;
};
}
class ProcedureManager {