Skip to content

Commit 64932c4

Browse files
committed
update
1 parent 2c7c91d commit 64932c4

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

pyWrapper.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ int callBack(Response *resp, std::string sid) {
541541
spdlog::get("stderr_console")->error("find error from python: {}", resp->errCode);
542542
return resp->errCode;
543543
}
544-
544+
char* ptr;
545545
int dataSize = resp->list.size();
546546
if (dataSize == 0) {
547547
spdlog::get("stderr_console")->error("error, not find any data from resp");
@@ -564,7 +564,10 @@ int callBack(Response *resp, std::string sid) {
564564
spdlog::get("stderr_console")->error("can't malloc memory for data, sid:{}", sid);
565565
return ret;
566566
}
567-
memcpy(pr, (const void *) itemData.data.ptr(), itemData.len);
567+
ptr = PyBytes_AsString(itemData.data.ptr());
568+
Py_ssize_t size = PyBytes_GET_SIZE(itemData.data.ptr());
569+
memcpy(pr, ptr,itemData.len );
570+
// 还是有问题::memcpy(pr, (const void *) itemData.data.ptr(), itemData.len);
568571
//char *data_ = new char[itemData.data.length()+1];
569572
// strdup(.c_str());
570573
tmpData->data = pr;
@@ -647,6 +650,7 @@ void DelHandleSid(char *handle) {
647650

648651
void DelSidCallback(std::string sid) {
649652
RECORD_MUTEX.lock();
653+
650654
SID_CB.erase(sid);
651655
RECORD_MUTEX.unlock();
652656
}

wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ wrapperExecAsync(const char *usrTag, pParamList params, pDataList reqData, wrapp
352352
break;
353353
}
354354
}
355-
spdlog::debug("starting exec: is:{},sid:{}", gettid(), sid);
355+
spdlog::debug("starting exec async: is:{},sid:{}", gettid(), sid);
356356
//构建请求参数
357357
std::map <std::string, std::string> pyParams;
358358

@@ -361,7 +361,7 @@ wrapperExecAsync(const char *usrTag, pParamList params, pDataList reqData, wrapp
361361
continue;
362362
}
363363
pyParams.insert({p->key, p->value});
364-
spdlog::debug("wrapper exec param, key:{},value:{},sid:{}", p->key, p->value, sid);
364+
spdlog::debug("wrapper exec async param, key:{},value:{},sid:{}", p->key, p->value, sid);
365365
}
366366
//构建请求数据
367367
int dataNum = 0;

0 commit comments

Comments
 (0)