Skip to content

Commit a912bbd

Browse files
committed
Proxy增加onStreamComplete回调, 功能见API手册。
1 parent cfd1d57 commit a912bbd

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

kbe/src/server/baseapp/data_download.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ error_(false)
4949
DataDownload::~DataDownload()
5050
{
5151
SAFE_RELEASE_ARRAY(stream_);
52+
53+
Proxy* proxy = static_cast<Proxy*>(Baseapp::getSingleton().findEntity(entityID_));
54+
55+
if(proxy)
56+
{
57+
proxy->onStreamComplete(id_, totalSentBytes_ == totalBytes_);
58+
}
5259
}
5360

5461
//-------------------------------------------------------------------------------------

kbe/src/server/baseapp/proxy.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -798,5 +798,14 @@ bool Proxy::sendToClient(bool expectData)
798798
return true;
799799
}
800800

801+
//-------------------------------------------------------------------------------------
802+
void Proxy::onStreamComplete(int16 id, bool success)
803+
{
804+
SCOPED_PROFILE(SCRIPTCALL_PROFILE);
805+
806+
SCRIPT_OBJECT_CALL_ARGS2(this, const_cast<char*>("onStreamComplete"),
807+
const_cast<char*>("hO"), id, success ? Py_True : Py_False);
808+
}
809+
801810
//-------------------------------------------------------------------------------------
802811
}

kbe/src/server/baseapp/proxy.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,11 @@ class Proxy : public Base
112112
*/
113113
void onEntitiesEnabled(void);
114114

115+
/**
116+
一个数据下载任务完成
117+
*/
118+
void onStreamComplete(int16 id, bool success);
119+
115120
/**
116121
登陆尝试, 当正常的登陆失败之后, 调用这个接口再进行尝试
117122
*/

0 commit comments

Comments
 (0)