P2P_CLUSTER
连接策略,我在让我的设备连接和保持连接方面遇到了问题。根据我的跟踪日志,看起来这些设备正在成功连接,然后立即断开连接。
以下是我目前看到的一系列事件:
-
我们发现另一个节点(即,点击onEndpointFound回调),然后发出requestConnection
-
-
-
-
紧接着,我们击中了onDisconnected(双方都处于未知状态)
这是一个很大的进步,现在这些设备几乎总是能建立成功(持久)的连接。然而,有时需要2-3次尝试。
-
我们击中了
onEndpointFound
和
requestConnection
-
我们击中了
onConnectionInitiated
-
我们击中了
onConnectionResult
成功连接。
-
onDisconnected
-
我们停止发现,等待3秒,重新启动发现
-
但通过第三次连接过程,我们获得了良好的持久连接,并且能够可靠地发送和接收数据。
更新:广告客户端的异常导致断开连接?
10-09 19:17:26.365 29232-29232/? E/SearchServiceStarter: Task 174 failed or timed out. Client 128565203126930423 disconnecting from SearchService!
java.util.concurrent.CancellationException: Task was cancelled.
at com.google.common.util.concurrent.d.cp(SourceFile:75)
at com.google.common.util.concurrent.d.get(SourceFile:57)
at com.google.common.util.concurrent.cj.n(SourceFile:2)
at com.google.common.util.concurrent.ay.l(SourceFile:50)
at com.google.common.util.concurrent.ba.run(SourceFile:5)
at com.google.android.apps.gsa.shared.util.concurrent.a.bc.run(SourceFile:2)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:5299)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:831)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:647)
at dalvik.system.NativeStart.main(Native Method)
这有助于您诊断问题吗?