适配Android

This commit is contained in:
xzl 2017-05-25 17:59:40 +08:00
parent f6e79584ce
commit f21f2ba7ac
2 changed files with 24 additions and 8 deletions

View File

@ -323,10 +323,11 @@
<extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactExtension="a" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.staticLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.staticLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.1307511880.1947026272.1008616174.636088656" name="Android" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
<configuration artifactExtension="so" artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.sharedLib" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.sharedLib,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.cross.exe.debug.1307511880.1947026272.1008616174.636088656" name="Android" parent="cdt.managedbuild.config.gnu.cross.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.cross.exe.debug.1307511880.1947026272.1008616174.636088656." name="/" resourcePath="">
<toolChain id="cdt.managedbuild.toolchain.gnu.cross.base.1496829101" name="Cross GCC" superClass="cdt.managedbuild.toolchain.gnu.cross.base">
<option id="cdt.managedbuild.option.gnu.cross.prefix.1735944082" name="Prefix" superClass="cdt.managedbuild.option.gnu.cross.prefix" useByScannerDiscovery="false" value="arm-linux-androideabi-" valueType="string"/>
@ -357,14 +358,13 @@
</option>
<inputType id="cdt.managedbuild.tool.gnu.cpp.compiler.input.1021305739" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.input"/>
</tool>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1602894146" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker"/>
<tool id="cdt.managedbuild.tool.gnu.cross.c.linker.1602894146" name="Cross GCC Linker" superClass="cdt.managedbuild.tool.gnu.cross.c.linker">
<option defaultValue="true" id="gnu.c.link.option.shared.662763664" name="Shared (-shared)" superClass="gnu.c.link.option.shared" valueType="boolean"/>
</tool>
<tool command="g++ -pthread -static-libstdc++" id="cdt.managedbuild.tool.gnu.cross.cpp.linker.300585526" name="Cross G++ Linker" superClass="cdt.managedbuild.tool.gnu.cross.cpp.linker">
<option id="gnu.cpp.link.option.paths.2028149580" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths">
<listOptionValue builtIn="false" value="/home/xzl/workspace/ZLToolKit/ARM"/>
</option>
<option id="gnu.cpp.link.option.libs.1919736544" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs">
<listOptionValue builtIn="false" value="ZLToolKit"/>
</option>
<option id="gnu.cpp.link.option.paths.2028149580" name="Library search path (-L)" superClass="gnu.cpp.link.option.paths" useByScannerDiscovery="false" valueType="libPaths"/>
<option id="gnu.cpp.link.option.libs.1919736544" name="Libraries (-l)" superClass="gnu.cpp.link.option.libs" useByScannerDiscovery="false" valueType="libs"/>
<option defaultValue="true" id="gnu.cpp.link.option.shared.791687128" name="Shared (-shared)" superClass="gnu.cpp.link.option.shared" useByScannerDiscovery="false" valueType="boolean"/>
<inputType id="cdt.managedbuild.tool.gnu.cpp.linker.input.2106177481" superClass="cdt.managedbuild.tool.gnu.cpp.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>

View File

@ -22,10 +22,18 @@ public:
HttpsSession(const std::shared_ptr<ThreadPool> &pTh, const Socket::Ptr &pSock):
HttpSession(pTh,pSock){
m_sslBox.setOnEncData([&](const char *data, uint32_t len){
#ifdef ANDROID
public_send(data,len);
#else//ANDROID
HttpSession::send(data,len);
#endif//ANDROID
});
m_sslBox.setOnDecData([&](const char *data, uint32_t len){
#ifdef ANDROID
public_onRecv(data,len);
#else//ANDROID
HttpSession::onRecv(data,len);
#endif//ANDROID
});
}
virtual ~HttpsSession(){
@ -35,6 +43,14 @@ public:
TimeTicker();
m_sslBox.onRecv(pBuf->data(), pBuf->size());
}
#ifdef ANDROID
int public_send(const char *data, uint32_t len){
return HttpSession::send(data,len);
}
void public_onRecv(const char *data, uint32_t len){
HttpSession::onRecv(data,len);
}
#endif//ANDROID
private:
virtual int send(const string &buf) override{
TimeTicker();