ConnectSDK / Connect-SDK-Cordova-Plugin

Cordova/PhoneGap plugin for Connect SDK
Apache License 2.0
69 stars 46 forks source link

ConnectSDK.discoveryManager.stopDiscovery() causes FireTV to disconnect #41

Closed scottmizo closed 8 years ago

scottmizo commented 8 years ago

Cordova plugin 1.6.0. Cordova android 4.1.1 Android-22 Running on Android 5.1.1

After connecting to a FireTV device, calling stopDiscovery() disconnects the device. I have verified this with the Connect-SDK-Cordova-API-Sampler app. Roku, Chromecast and AppleTV all maintain device connection after stopDiscovery().

LogCat is as follows:

I/chromium(20391): [INFO:CONSOLE(104)] "selected device in picker", source: file:///android_asset/www/js/controllers/DiscoveryManagerController.js (104) I/chromium(20391): [INFO:CONSOLE(36)] "pending device changed", source: file:///android_asset/www/js/controllers/ConnectableDeviceController.js (36) I/chromium(20391): [INFO:CONSOLE(39)] "device is already connected", source: file:///android_asset/www/js/controllers/ConnectableDeviceController.js (39) I/chromium(20391): [INFO:CONSOLE(64)] "device connected", source: file:///android_asset/www/js/controllers/ConnectableDeviceController.js (64) I/WPControllerAdapter(20391): shutdownAdapter - Init I/WPControllerAdapter(20391): shutdownAdapter - Enter I/WPControllerAdapter(20391): removeRegistrarListener - Enter W/System.err(20391): java.net.SocketException: Socket closed W/System.err(20391): at libcore.io.Posix.recvfromBytes(Native Method) W/System.err(20391): at libcore.io.Posix.recvfrom(Posix.java:185) W/System.err(20391): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250) W/System.err(20391): at libcore.io.IoBridge.recvfrom(IoBridge.java:553) W/System.err(20391): at java.net.SocketException: Socket closed W/System.err(20391): at libcore.io.Posix.recvfromBytes(Native Method) W/System.err(20391): at libcore.io.Posix.recvfrom(Posix.java:185) W/System.err(20391): at libcore.io.BlockGuardOs.recvfrom(BlockGuardOs.java:250) W/System.err(20391): at libcore.io.IoBridge.recvfrom(IoBridge.java:553) W/System.err(20391): at java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:163) W/System.err(20391): at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:171) W/System.err(20391): at java.net.DatagramSocket.receive(DatagramSocket.java:274) W/System.err(20391): at com.connectsdk.discovery.provider.ssdp.SSDPClient.multicastReceive(SSDPClient.java:109) W/System.err(20391): at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$4.run(SSDPDiscoveryProvider.java:268) W/System.err(20391): at java.lang.Thread.run(Thread.java:818) W/System.err(20391): java.net.PlainDatagramSocketImpl.doRecv(PlainDatagramSocketImpl.java:163) W/System.err(20391): at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:171) W/System.err(20391): at java.net.DatagramSocket.receive(DatagramSocket.java:274) W/System.err(20391): at java.net.SocketException: Socket is closed W/System.err(20391): com.connectsdk.discovery.provider.ssdp.SSDPClient.responseReceive(SSDPClient.java:99) W/System.err(20391): at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$3.run(SSDPDiscoveryProvider.java:251) W/System.err(20391): at java.lang.Thread.run(Thread.java:818) W/System.err(20391): at java.net.DatagramSocket.checkOpen(DatagramSocket.java:440) W/System.err(20391): at java.net.DatagramSocket.receive(DatagramSocket.java:265) W/System.err(20391): at com.connectsdk.discovery.provider.ssdp.SSDPClient.responseReceive(SSDPClient.java:99) W/System.err(20391): at com.connectsdk.discovery.provider.SSDPDiscoveryProvider$3.run(SSDPDiscoveryProvider.java:251) W/System.err(20391): at java.lang.Thread.run(Thread.java:818) I/WPControllerAdapter(20391): removeRegistrarListener - Exit I/WPControllerAdapter(20391): shutdownAdapter - Exit I/WhisperLink(20391): PlatformManager - Stopping platform manager I/WhisperLink(20391): GenericAndroidPlatform - Tearing down network state change listener, listner=com.amazon.whisperlink.platform.GenericAndroidNetworkStateChangeListener@5ee9315 I/WhisperLink(20391): TThreadPoolServiceRouter: INET: - Server socket is not open, recover router and try again W/WhisperLink(20391): PlatformCoreManager - Thread pool serve failed, retry=0, channel=inet, isSecure=true W/WhisperLink(20391): org.apache.thrift.transport.TTransportException: Threadpool router server transport is not open W/WhisperLink(20391): at com.amazon.whisperlink.internal.TThreadPoolServiceRouter.serve(TThreadPoolServiceRouter.java:553) W/WhisperLink(20391): at com.amazon.whisperlink.core.platform.PlatformCoreManager$1.run(PlatformCoreManager.java:417) W/WhisperLink(20391): at com.amazon.whisperlink.util.TaskExecutor$Task.doRun(TaskExecutor.java:495) W/WhisperLink(20391): at com.amazon.whisperlink.util.TaskExecutor$Task.run(TaskExecutor.java:472) W/WhisperLink(20391): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) W/WhisperLink(20391): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) W/WhisperLink(20391): at java.lang.Thread.run(Thread.java:818) W/WhisperLink(20391): Caused by: org.apache.thrift.transport.TTransportException: java.net.SocketException: Socket closed W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:141) W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:48) W/WhisperLink(20391): at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:31) W/WhisperLink(20391): at com.amazon.whisperlink.transport.TWhisperLinkServerTransport.acceptImpl(TWhisperLinkServerTransport.java:53) W/WhisperLink(20391): at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:31) W/WhisperLink(20391): at com.amazon.whisperlink.internal.TThreadPoolServiceRouter.serve(TThreadPoolServiceRouter.java:520) W/WhisperLink(20391): ... 6 more W/WhisperLink(20391): Caused by: java.net.SocketException: Socket closed W/WhisperLink(20391): at libcore.io.Posix.accept(Native Method) W/WhisperLink(20391): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:63) W/WhisperLink(20391): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:89) W/WhisperLink(20391): at java.net.ServerSocket.implAccept(ServerSocket.java:216) W/WhisperLink(20391): at com.android.org.conscrypt.OpenSSLServerSocketImpl.accept(OpenSSLServerSocketImpl.java:170) W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:130) W/WhisperLink(20391): ... 11 more I/WhisperLink(20391): PlatformCoreManager - Thread pool is stopped normally, don't need to retry anymore I/WhisperLink(20391): TThreadPoolServiceRouter: INET: - Server socket is not open, recover router and try again W/WhisperLink(20391): PlatformCoreManager - Thread pool serve failed, retry=0, channel=inet, isSecure=false W/WhisperLink(20391): org.apache.thrift.transport.TTransportException: Threadpool router server transport is not open W/WhisperLink(20391): at com.amazon.whisperlink.internal.TThreadPoolServiceRouter.serve(TThreadPoolServiceRouter.java:553) W/WhisperLink(20391): at com.amazon.whisperlink.core.platform.PlatformCoreManager$1.run(PlatformCoreManager.java:417) W/WhisperLink(20391): at com.amazon.whisperlink.util.TaskExecutor$Task.doRun(TaskExecutor.java:495) W/WhisperLink(20391): at com.amazon.whisperlink.util.TaskExecutor$Task.run(TaskExecutor.java:472) W/WhisperLink(20391): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) W/WhisperLink(20391): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) W/WhisperLink(20391): at java.lang.Thread.run(Thread.java:818) W/WhisperLink(20391): Caused by: org.apache.thrift.transport.TTransportException: java.net.SocketException: Socket closed W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:141) W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:48) W/WhisperLink(20391): at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:31) W/WhisperLink(20391): at com.amazon.whisperlink.transport.TWhisperLinkServerTransport.acceptImpl(TWhisperLinkServerTransport.java:53) W/WhisperLink(20391): at org.apache.thrift.transport.TServerTransport.accept(TServerTransport.java:31) W/WhisperLink(20391): at com.amazon.whisperlink.internal.TThreadPoolServiceRouter.serve(TThreadPoolServiceRouter.java:520) W/WhisperLink(20391): ... 6 more W/WhisperLink(20391): Caused by: java.net.SocketException: Socket closed W/WhisperLink(20391): at libcore.io.Posix.accept(Native Method) W/WhisperLink(20391): at libcore.io.BlockGuardOs.accept(BlockGuardOs.java:63) W/WhisperLink(20391): at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:89) W/WhisperLink(20391): at java.net.ServerSocket.implAccept(ServerSocket.java:216) W/WhisperLink(20391): at java.net.ServerSocket.accept(ServerSocket.java:140) W/WhisperLink(20391): at org.apache.thrift.transport.TServerSocket.acceptImpl(TServerSocket.java:130) W/WhisperLink(20391): ... 11 more

eunikolsky commented 8 years ago

@scottmizo, it is a known issue with FireTV devices. The Fling SDK requires the discovery to work in order to use any connected Fire TV device. Strange, it's not written in the Android docs, but here is the same for iOS: https://github.com/ConnectSDK/Connect-SDK-iOS-FireTV#limitationscaveats

scottmizo commented 8 years ago

@eunikolsky Thanks!