fix bug of init httpdnsclient

This commit is contained in:
zhongchao
2023-06-01 14:12:29 +08:00
parent 57517a1a16
commit 1bd1be4c39
2 changed files with 21 additions and 20 deletions

View File

@@ -14,7 +14,6 @@ import com.google.protobuf.ByteString;
import com.google.protobuf.InvalidProtocolBufferException;
import com.google.protobuf.MessageLiteOrBuilder;
import com.mogo.cloud.passport.MoGoAiCloudClient;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.cloud.socket.entity.MsgBody;
import com.mogo.cloud.socket.internal.InternalSocketManager;
import com.mogo.cloud.socket.third.ThirdSocketManager;
@@ -34,13 +33,10 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class SocketManager implements IMogoCloudSocketManager {
private static volatile SocketManager mInstance;
private MoGoAiCloudClientConfig cloudClientConfig;
private static final String TAG = "SocketManager";
private static volatile SocketManager mInstance;
private SocketManager() {
cloudClientConfig = MoGoAiCloudClient.getInstance().getAiCloudClientConfig();
}
public static SocketManager getInstance() {
@@ -76,7 +72,7 @@ public class SocketManager implements IMogoCloudSocketManager {
@Override
public void init(Context context, String sn, double lat, double lon) {
if (cloudClientConfig.isThirdLogin()) {
if (check()) {
ThirdSocketManager.getInstance().init(context, sn, lat, lon);
} else {
InternalSocketManager.getInstance().init(context);
@@ -85,7 +81,7 @@ public class SocketManager implements IMogoCloudSocketManager {
@Override
public void reConnect() {
if (cloudClientConfig.isThirdLogin()) {
if (check()) {
ThirdSocketManager.getInstance().reConnect();
}
}
@@ -163,7 +159,7 @@ public class SocketManager implements IMogoCloudSocketManager {
}
final byte[] pb = convertToPBBytes(body.getMsgType(), body.getContent());
if (cloudClientConfig.isThirdLogin()) {
if (check()) {
ThirdSocketManager.getInstance().sendMsg(appId, pb, headerType, true, body.getMsgId());
} else {
InternalSocketManager.getInstance().sendMsg(pb, headerType, true, body.getMsgId());
@@ -275,11 +271,16 @@ public class SocketManager implements IMogoCloudSocketManager {
}
public synchronized void release() {
if (cloudClientConfig.isThirdLogin()) {
if (check()) {
ThirdSocketManager.getInstance().release();
} else {
InternalSocketManager.getInstance().release();
}
}
private boolean check(){
return (MoGoAiCloudClient.getInstance().getAiCloudClientConfig()!= null
&& MoGoAiCloudClient.getInstance().getAiCloudClientConfig().isThirdLogin());
}
}

View File

@@ -36,24 +36,24 @@ PASSWORD=xintai2018
RELEASE=true
# AI CLOUD 云平台
# 工具类
MOGO_UTILS_VERSION=1.4.7.7
MOGO_UTILS_VERSION=1.4.7.8
# 网络请求
MOGO_NETWORK_VERSION=1.4.7.7
MOGO_NETWORK_VERSION=1.4.7.8
# 鉴权
MOGO_PASSPORT_VERSION=1.4.7.7
MOGO_PASSPORT_VERSION=1.4.7.8
# 常链接
MOGO_SOCKET_VERSION=1.4.7.7
MOGO_SOCKET_VERSION=1.4.7.8
# 数据采集
MOGO_REALTIME_VERSION=1.4.7.7
MOGO_REALTIME_VERSION=1.4.7.8
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.7.7
MOGO_TANLU_VERSION=1.4.7.8
# 直播推流
MOGO_LIVE_VERSION=1.4.7.7
MOGO_LIVE_VERSION=1.4.7.8
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.7.7
MOGO_TRAFFICLIVE_VERSION=1.4.7.8
# 定位服务
MOGO_LOCATION_VERSION=1.4.7.7
MOGO_LOCATION_VERSION=1.4.7.8
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.7.7
MOGO_TELEMATIC_VERSION=1.4.7.8
# v2x
MOGO_V2X_VERSION=1.4.7.7
MOGO_V2X_VERSION=1.4.7.8