Update example.conf based on commit c080c17237deb4e4cfb891b81ab56db8e3e8660b
We can't connect to a GBT pool at all with fix protocol enabled.
(cherry picked from commit 8edba014477d26bfc6aefbe69af29c5fc1dcc2d2)
api.c: Release io_data->ptr when releasing io_data in io_free()
(cherry picked from commit 1a672cd68bdb6ae7160a0905a2afa3f1f4f8904c)
api.c: Release apisock on error in api()
(cherry picked from commit b1c3af57cdf7c8e6ec0bd40f5f33a9223976e756)
util.c: Decreasing reference count on allocated JSON obects to prevent memory leak
(cherry picked from commit 8aea685963431dbdff4bc1a5dd67e8965befa538)
api.c trylock() add missing locklock
(cherry picked from commit 98329cb329566e593291caeac4be01d3eacaf280)
Do not hold the mining thread lock in restart_threads when calling the driver flush work commands.
(cherry picked from commit 16bdb52805860e79480c0c37bca684418ca4bb64)
Set priority of various threads if possible.
(cherry picked from commit fcbd3dc54f2127da8b84e3f00abb17d1d6736dc1)
Prevent a deadlock with use of restart_threads by spawning a thread to send the driver flush work messages.
(cherry picked from commit d3daff47ce66e0e7fd64d0cfee5e8dd8f4483b09)
line 2913 added urlencode

There was a cross site scripting vulnerability due to insufficient input sanitation on the $pg parameter.  This patch fixes that issue.(cherry picked from commit ffa4be6d14995c5486e54ec126209c85e5124b4b)
Decrement json references in api.c to not leak memory.
(cherry picked from commit a3df3a853395c85ccdedecb74cbf0735508e901c)
The json_val in api.c is a borrowed reference, not a new one so don't decref it.
(cherry picked from commit 009511c995458c00a5f46426c8e80ddb94c20cbb)
Silence irrelevant warning.
(cherry picked from commit 45950890bf861e9de9c7d6f21a6c762d299950d8)
Drop json stratum auth failed message log level to verbose.
(cherry picked from commit 4715ee84c5c6a8643ca18fb78decee0047631fc0)
Initialise devices before attempting to connect to pools to allow their thread prepare function to be called before having to connect to pools.

(based on Con Kolivas commit 1058f36d82b2d18a410ceee5378a903d4b43c7b8)
Fix json parsing in api.c
(cherry picked from commit b6a61ca02892f18e3a14a0b4e7ed2b992a13b29e)
Fixed one byte stack overflow in mcast recvfrom.

The actual overflow happens when enforcing the NULL termination shortly
after the recvfrom.
(cherry picked from commit b382ad9bcaf0aea596387dfe49b4f7df173b30e3)
Minimise risk of nonce2 overflow with small nonce2 lengths by always encoding the work little endian, and increasing the maximum size of nonce2 to 8 bytes.
(cherry picked from commit 24d65294b86795da2f122a26da0793aaf67fcc4f)
api.c no decref if not json
(cherry picked from commit 9c288a3ac8a8c73c41f9acfc60666879f3bbda3e)