Commit Graph

6 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
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
Adrian Moennich 2c369ef63f Do not attempt EventServer connection via IPv6
EventServer only listens on IPv4 addresses, even if the machine running
kodi has IPv6 support (the webserver on the other hand does listen on
both IPv4 and IPv6).

fixes #148
2015-12-15 21:03:13 +01:00
Synced Synapse 68ab545651 Add EventServer configuration options in wizard and host editing. 2015-06-21 15:04:54 +01:00
Synced Synapse a429ec17b4 Change D-Pad buttons behaviour, so that they don't fire a command on each touch event. The other scheme makes them too sensitive, which causes them to issue commands when the user swipes on the remote screen for instance. 2015-06-18 18:17:29 +01:00
Synced Synapse 8ce709c55a D-Pad on the remote screen now uses EventServer by default.
Not finished: EventServer port is still hardcoded (9777) and there's no possibility of configuration.
2015-06-17 22:30:40 +01:00