Commit Graph

13 Commits

Author SHA1 Message Date
Synced Synapse 7dfd982643 Tweak connection threads
This PR fixes some issues with connections and threading. Specifically, the  change in #618 introduced threading in `HostConnection`, which had some issues. To fix them, the following changes were made:
- A specific TCP listener thread is used and manually started, instead of using one of the threads in the pool. The TCP listener thread is a long lived thread that should always be running (as long as the connection is through TCP), blocked listening on the TCP socket, so it shouldn't be managed in a pool, where, theoretically, it can be paused and reused. 
- Changed the number of threads to 5. We shouldn't need more than this, otherwise we can overwhelm some Kodi hardware.
- Had to sprinkle some `synchronized` to avoid race conditions. For instance, through a TCP connection, as soon as Kore is opened (on the remote screen) it will call at least `GetActivePlayers`, `GetProperties`, `Ping`. If the TCP socket isn't set up yet, each of these calls would create a socket (and a TCP listener thread), so we would open 3 or more sockets when we should just open 1. A `synchronized` in `executeThroughTcp` prevents this. The others prevent similar issues.

Aditionally:
- Tweaked the playlist fetching code, so that it happens exclusively in `HostConnectionObserver` and when PlaylistFragment is notified of changes, it already gets the playlist data. This somewhat simplifies the code, and makes it more consistent with the Player Observer code;
- Change `EventServerConnection` to accept a Handler on which to post the result of the connection, so that the caller can control on which thread the result is called;
- Calls to the various `RegisterObserver` loose the reply immediately parameter, as it was always true.
2019-09-28 22:10:04 +02:00
Synced Synapse b824930d8e Tweak periodic checking Kodi version 2019-02-08 22:30:48 +01:00
Synced Synapse 75f8326fe4 Simplify sharing intent handling
Redesign ApiFuture to be more generic and independent of other classes
2018-04-24 13:36:35 +02:00
Mon Zafra 1e9160c733 Refactored share logic to show a notification when an item is added to the playlist (#473)
- added method to HostConnection that returns a Future object instead of
  taking a callback.
- added logic for handling null Handlers in HostConnection methods
- added method to HostManager to run a function that takes a HostConnection
  in a background thread where the Future API results above can be
  synchronously composed.
- replaced chain of callbacks in RemoteActivity with a sequence of
  future gets in OpenSharedUrl.
2018-01-26 14:03:30 +00:00
Aneesh Agrawal 66c145d778 Enable manual configuration of https (#338)
* Allow specifying HTTPS Hosts manually
This is not exposed in the UI, but on the manual host configuration screen, if the address starts with a  "http://" or "https://" this will be stripped and the `isHttps` flag set appropriately.

Additionally, the port can be configured as part of the address as well.
Any port specified as part of the address takes precedence over the explicit HTTP port box, to allow easy copy-pasting of an entire URL for a host.

This enables using Kore with Kodi instances available though HTTPS (e.g. via a reverse proxy).
2017-01-27 15:17:39 +00:00
Synced Synapse 92773ea57c Prevent crash introduced in a4945c8534 when there are no hosts configured 2016-11-16 12:10:20 +00:00
Synced Synapse a4945c8534 Add Kodi version to Hosts table on DB and keep it periodically updated 2016-11-15 19:09:23 +00:00
George Kankava 079cf4e759 squid:S1155 - Collection.isEmpty() should be used to test for emptiness 2016-06-29 14:17:39 +04:00
Synced Synapse 68ab545651 Add EventServer configuration options in wizard and host editing. 2015-06-21 15:04:54 +01:00
Synced Synapse 1fc9eb3301 Switched HTTP library. Using OkHttp explicitly now, instead of the default Android one, which varies acroos OS versions.
OkHttp is also used as the backend for loading images (Picasso).
Added disk cache to image loading.
2015-04-18 10:52:31 +01:00
Synced Synapse 59a42eb8bb Fixed exception reported on Google Play (not sure how to trigger it, but this can't hurt) 2015-04-13 22:59:49 +01:00
Synced Synapse 5193afd4b6 Changed settings to always use Default Shared Preferences. Settings is now only an interface with the definition of the keys stored in Shered Preferences 2015-03-11 18:38:59 +00:00
Synced Synapse ed584fb9b7 Changed namespace/appid to org.xbmc.kore 2015-03-09 21:35:18 +00:00