562935844@qq.com
2022-05-13 a3f9e5ce8dce3d86a60a79b85ce44424a612c6fa
HDLSDK/hdl-connect/src/main/java/com/hdl/sdk/connect/socket/HdlSocketHelper.java
@@ -1,16 +1,14 @@
package com.hdl.sdk.connect.socket;
import android.text.TextUtils;
import com.hdl.sdk.common.event.EventDispatcher;
import com.hdl.sdk.common.event.EventListener;
import com.hdl.sdk.common.utils.LogUtils;
import com.hdl.sdk.common.utils.TextUtils;
import com.hdl.sdk.common.utils.ThreadToolUtils;
import com.hdl.sdk.connect.bean.LinkRequest;
import com.hdl.sdk.socket.SocketBoot;
import com.hdl.sdk.socket.udp.UdpSocketBoot;
import java.net.InetSocketAddress;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -21,7 +19,7 @@
 */
public class HdlSocketHelper {
    private static final Long DEF_SEND_TIMEOUT = 500L;
    private static final Long DEF_SEND_TIMEOUT = 1000L;
    private static final int DEF_MAX_RETRY = 4;
    private static final int DEF_SEND_ONE = 1;
@@ -173,7 +171,7 @@
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        LogUtils.e("发送数据失败:" + e.getMessage());
                    }
                } else {
                    //超出重发次数并没有收到回复
@@ -206,13 +204,17 @@
    private void notifyFailure() {
        //移除监听
        removeListener();
        if (sendThread != null) {
            sendThread.shutdownNow();
            sendThread = null;
        }
        if (listener != null) {
            listener.onFailure();
            listener = null;
        try {
            if (sendThread != null) {
                sendThread.shutdownNow();
                sendThread = null;
            }
            if (listener != null) {
                listener.onFailure();
                listener = null;
            }
        } catch (Exception e) {
        }
    }
}