Tencent / VasSonic

VasSonic is a lightweight and high-performance Hybrid framework developed by tencent VAS team, which is intended to speed up the first screen of websites working on Android and iOS platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

3.1.0版本调用sonicSession.destroy()报错

1079107009 opened this issue · comments

Activity销毁时调用

@Override
protected void onDestroy() {
    if (null != mSonicSession) {
        mSonicSession.destroy();
        mSonicSession = null;
    }
    super.onDestroy();
}

打印日志如下:
05-14 13:18:24.556 12741-12741/me.suncloud.marrymemo D/SonicSdk_SonicServer: session(84693) server disconnect error:null.
05-14 13:18:24.556 12741-12741/me.suncloud.marrymemo D/SonicSdk_SonicEngine: onSessionStateChange:session(84693) from state 2 -> 3
05-14 13:18:24.556 12741-12741/me.suncloud.marrymemo D/SonicSdk_SonicSession: session(84693) final destroy, force=false.

具体原因
server.disconnect();

public void disconnect() {
    try {
        BufferedInputStream bufferedInputStream = connectionImpl.getResponseStream();
        if (bufferedInputStream != null) {
            bufferedInputStream.close();
        }
    } catch (Throwable e) {
        SonicUtils.log(TAG, Log.ERROR, "session(" + session.sId + ") server disconnect error:" + e.getMessage() + ".");
    }
    connectionImpl.disconnect();
}

bufferedInputStream.close();android.os.NetworkOnMainThreadException

感谢反馈,我们会在近期修复相关bug