MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / configure

Method configure

libapp2sys/src/main/cpp/protocol.h:1248–1278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1246 }
1247
1248 int64_t configure(const char *data, int tid, int64_t timestamp) {
1249 IClientEngine *pEngine = engine();
1250 if (!pEngine) {
1251 return -3;
1252 }
1253 int64_t requestid = 0L;
1254 if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json
1255 cJSON *jsonRequest;
1256 jsonRequest = cJSON_Parse(data);
1257 cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION);
1258 cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_CONFIGURE);
1259
1260 char *body = cJSON_Print(jsonRequest);
1261 std::string str(body);
1262 pdbg("configure:%s", body);
1263 uint32_t len = str.length();
1264 cJSON_Delete(jsonRequest);
1265 requestid = pEngine ->sendReq(FUNC_CONFIGURE, (uint8_t *)body, len, tid, timestamp);
1266 free(body);
1267 } else {
1268 amc::Configuration request;
1269 request.set_data(data);
1270 uint32_t len = request.ByteSize();
1271 uint8_t body[len];
1272 request.SerializeToArray(body, len);
1273 requestid = pEngine->sendReq(FUNC_CONFIGURE, body, len, tid, timestamp);
1274
1275 pdbg("configure requestid:%lld, request size:%d", requestid, request.ByteSize());
1276 }
1277 return requestid;
1278 }
1279
1280 int64_t getParameters(const char *data, int tid, int64_t timestamp) {
1281 IClientEngine *pEngine = engine();

Callers

nothing calls this directly

Calls 6

cJSON_ParseFunction · 0.85
cJSON_AddNumberToObjectFunction · 0.85
cJSON_PrintFunction · 0.85
cJSON_DeleteFunction · 0.85
ByteSizeMethod · 0.80
sendReqMethod · 0.45

Tested by

no test coverage detected