1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-01 18:55:36 +00:00
Commit Graph

471 Commits

Author SHA1 Message Date
Con Kolivas
3c949e5f6c Try to extract the sessionid associated with mining.notify on 3rd level array and submit it along with the userid to support mining resume, failing gracefully and restarting if the pool rejects it. 2013-02-25 10:43:48 +11:00
Con Kolivas
5a3b374962 Update copyright dates. 2013-02-25 08:59:11 +11:00
Con Kolivas
6bf79626b8 Merge branch 'master' into usb-dev 2013-02-23 13:59:37 +11:00
Con Kolivas
3dcdb94921 Cope with misread sessionid on stratum for now. 2013-02-23 13:07:47 +11:00
ckolivas
6a0882f05b Use the sessionid as passed on stratum connect to attempt to resume a connection once and then clear it if it fails, to use a new connection. 2013-02-22 16:55:39 +11:00
ckolivas
68d691093c Move to storing the nonce1 in the work struct instead of the sessionid for the now defunct first draft mining.resume protocol. 2013-02-22 12:55:01 +11:00
ckolivas
22a50a5a0f Merge branch 'usb-dev' of github.com:ckolivas/cgminer into usb-dev 2013-02-17 00:10:36 +11:00
Con Kolivas
a7859bb416 Merge pull request #386 from luke-jr/bugfix_20130215a
Bugfix: Missing pool_no parameter to applog for no-stratum-sessionid debug message
2013-02-16 03:52:06 -08:00
Luke Dashjr
7473c3dc94 Bugfix: Missing pool_no parameter to applog for no-stratum-sessionid debug message 2013-02-16 05:06:38 +00:00
Con Kolivas
ab0cc58cb4 Merge branch 'master' into usb-dev 2013-02-15 23:15:11 +11:00
Con Kolivas
be4705a003 Provide support for mining.resume with stratum, currently re-authorising after successful resumption pending finalising of the protocol process. 2013-02-15 23:05:29 +11:00
Con Kolivas
4cde791e9f Provide basic framework for restarting stratum depending on whether resume support exists or not. 2013-02-15 21:31:44 +11:00
Con Kolivas
c29df9760f Abstract out the setting up of the stratum curl socket. 2013-02-15 21:03:39 +11:00
Con Kolivas
c851f39598 Store session id for stratum if the pool supports it for future mining.resume support. 2013-02-15 14:46:30 +11:00
Kano
c432c655f7 debug_cb buffer type warning 2013-02-13 14:50:55 +11:00
Con Kolivas
3c91b292a2 Merge branch 'master' into usb-dev 2013-02-07 18:02:38 +11:00
Con Kolivas
903c666326 Fix logic fail on partial writes with stratum send that was leading to corrupt message submissions. 2013-02-07 16:38:11 +11:00
Con Kolivas
0244998ef8 Merge branch 'master' into usb-dev 2013-02-04 11:23:20 +11:00
Con Kolivas
d644fdf1f4 Cache the coinbase length to speed up stratum work generation. 2013-02-04 11:19:12 +11:00
Con Kolivas
0870ab7532 Cache the header length when generating stratum work to avoid calculating it on every work generation, and to only need one alloc+sprintf, speeding up work generation. 2013-02-04 11:06:05 +11:00
Con Kolivas
51d11a28f9 Provide a wrapper for aligning lengths of size_t to 4 byte boundaries. 2013-02-04 10:19:12 +11:00
Kano
c1eae36f7b API stats - include pool network bytes + in miner.php 2013-02-02 20:14:33 +11:00
Con Kolivas
e1387dc85c Change the pool stratum socket buffer to be dynamically allocated to accomodate any size coinbase and keep receiving data in recv line for up to 60s if no end of line has been received. 2012-12-29 11:29:59 +11:00
Con Kolivas
6e2e7d36de Differentiate socket full from sock full. 2012-12-29 10:46:55 +11:00
Con Kolivas
7f46f6e91f Allow stratum to startup without notify but check it is valid before creating stratum work. 2012-12-29 10:42:45 +11:00
Con Kolivas
e1d7ecdd35 Do not try to generate stratum work unless the notify command has succeeded. 2012-12-29 09:45:40 +11:00
Con Kolivas
944af31b99 Parse anything in the stratum socket if it's full without waiting. Empty the socket even if a connection is not needed in case there are share returns. 2012-12-26 09:31:41 +11:00
Con Kolivas
cada0d3195 Check for EWOULDBLOCK when supported in send and recv as well. 2012-12-14 21:36:42 +11:00
Con Kolivas
2274af6a05 Use the raw send() command instead of curl_easy_send since curl raw socket usage introduces random bugs on windows. 2012-12-14 21:29:33 +11:00
Con Kolivas
f66d59df03 Use raw recv() command in place of curl_easy_recv since the curl implementation introduces random bugs on windows builds when the recv fails. 2012-12-14 21:20:52 +11:00
Kano
138465bf0c Pool store data transfer stats 2012-12-13 00:56:10 +11:00
Con Kolivas
ac3020f45b Include prctl header for thread renaming to work. 2012-12-10 22:02:31 +11:00
Con Kolivas
15e5e36bcd Return value of keep_sockalive is no longer used. 2012-12-09 14:13:24 +11:00
Con Kolivas
8fcc67f308 Remove dependency on mstcpip.h for windows build by making curl version >= 7.25.0 mandatory on windows builds, and use curl functions for keepalive whenever possible instead. 2012-12-09 13:39:37 +11:00
Con Kolivas
68f1b2c4b5 Set successful connect to true on auth stratum to allow summary on exit from single stratum pool. 2012-12-08 22:14:47 +11:00
Con Kolivas
be013e9699 Set pool probed to true on successful authorisation with stratum to avoid it being pinged later with pool_getswork. 2012-12-07 09:37:37 +11:00
Con Kolivas
fc5d3a0eaf Suspend stratum connections to backup pools when there is no requirement to potentially grab work from them. 2012-12-03 09:52:46 +11:00
Denis Ahrens
271b05ab04 setting the name of the threads for linux,freebsd,openbsd and osx
code is borrowed from bitcoins util.c, so it is already tested
2012-12-02 11:39:20 +01:00
Con Kolivas
fc66a41e85 Style police. 2012-12-02 20:49:40 +11:00
Con Kolivas
f94cff77e6 Microoptimise and remove redundant copy of strdup function in calloc_strcat. 2012-12-02 18:06:55 +11:00
Con Kolivas
0ae02c6ec4 Since we will be using calloc_str to put a string into it, convert the function to calloc_strcat which does it automatically. 2012-12-01 08:26:31 +11:00
Con Kolivas
ee8609d9a9 Provide helper functions calloc_str and realloc_strcat to create and extend arbitrary length arrays based on string length. 2012-11-29 12:48:17 +11:00
nelisky
6db7e2e5cf fixes target calc for mips openwrt 2012-11-24 13:12:19 -08:00
Con Kolivas
0b088d8d81 Provide rudimentary support for literal ipv6 addresses when parsing stratum URLs. 2012-11-18 18:08:14 +11:00
Con Kolivas
f14bf5b16c Merge pull request #326 from pshep/error_counters
Error counters
2012-11-17 22:06:49 -08:00
Con Kolivas
b3864d1a94 Support for fractional diffs and the classic just-below-1 share all FFs diff target. 2012-11-15 09:18:58 +11:00
Paul Sheppard
dad6c70420 Merge branch 'master' into error_counters 2012-11-06 09:46:05 -08:00
Con Kolivas
cc7c274543 Manage appropriate response codes for share submission with GBT. 2012-11-05 16:28:52 +11:00
Paul Sheppard
84173c6cc7 missing a break. 2012-11-04 20:38:11 -08:00
Paul Sheppard
9f74e650b3 Tidy up device error counts 2012-11-04 20:17:43 -08:00
Luke Dashjr
c2b5c5ee4c Bugfix: Free old stratum_work data before replacing it 2012-10-30 19:30:11 +11:00
Con Kolivas
c2861d683a There is no need for addrinfo any more. 2012-10-30 19:22:02 +11:00
ckolivas
a2d5783509 server and client sockaddr_in are no longer used in struct pool. 2012-10-30 16:45:27 +11:00
Con Kolivas
48f24223b8 Shorten the initiate stratum connect timeout to 30 seconds. 2012-10-29 12:35:21 +11:00
Con Kolivas
6f4c47ebd2 Make stratum socket fail more robust on windows by disabling the send buffer.
Reuse the same curl handle forcing a new connection instead of risking derefencing.
Add information about submission failure to stratum send.
2012-10-29 12:08:10 +11:00
Con Kolivas
aa97e87a13 Use keepalive with stratum sockets to improve its ability to detect broken connections. 2012-10-28 09:15:45 +11:00
Con Kolivas
d9276557f1 Show only the URL in the status bar to avoid long prefixes making for extra long lines. 2012-10-27 23:20:10 +11:00
Con Kolivas
6d3c880a25 Make sure to check pool stratum curl exists under lock before attempting any recv to not risk dereferencing upon attempting to reinitiate stratum. 2012-10-22 22:48:12 +11:00
Con Kolivas
e575763a80 Avoid redefining macros and align to 4 byte boundaries. 2012-10-22 22:06:00 +11:00
ckolivas
bb4bec98d5 Use select on stratum send to make sure the socket is writeable. 2012-10-17 09:34:32 +11:00
Con Kolivas
99adf397bd Failure to calloc in bin2hex is a fatal failure always so just check for that failure within the function and abort, simplifying the rest of the code. 2012-10-16 19:47:31 +11:00
Con Kolivas
b3d4258940 Provide locking around the change of the stratum curl structures to avoid possible races. 2012-10-16 19:22:48 +11:00
Con Kolivas
e5babfa25b Watch for buffer overflows on receiving data into the socket buffer. 2012-10-15 11:40:32 +11:00
Con Kolivas
2a9b3e33d3 String alignment to 4 byte boundaries and optimisations for bin<->hex conversions. 2012-10-14 09:54:04 +11:00
Con Kolivas
fc72ad5563 Off by one error. 2012-10-12 14:57:42 +11:00
Con Kolivas
9ccfcee6dc Prevent overflows of the port char array in extract_sockaddr. 2012-10-12 14:55:52 +11:00
ckolivas
7f522ef83c Add support for client.get_version for stratum. 2012-10-11 14:23:09 +11:00
Con Kolivas
a533f106fd Update reconnect message to show whole address including port. 2012-10-11 00:08:45 +11:00
Con Kolivas
5226a399c7 Look for null values and parse correct separate array entries for url and port with client reconnect commands for stratum. 2012-10-11 00:06:44 +11:00
Con Kolivas
7c04a00e62 The command for stratum is client.reconnect, not mining.reconnect. 2012-10-10 23:56:24 +11:00
Con Kolivas
783af8768b Implement rudimentary mining.reconnect support for stratum. 2012-10-10 23:41:29 +11:00
Con Kolivas
974f65c67f Ignore the value of stratum_active on calling initiate_stratum and assume we're always trying to reinitiate it, and set the active flag to false in that function. 2012-10-10 23:22:24 +11:00
Con Kolivas
07605fad60 stratum auth can be unset if we fail to authorise on subsequent calls to auth_stratum which undoes the requirement of setting it in one place so set it in pool_active. 2012-10-10 23:07:33 +11:00
Con Kolivas
ef822a25ed Detect stratum outage based on either select timing out or receiving an empty buffer and properly re-establish connection by disabling the stratum_active flag, coping with empty buffers in parse_stratum. 2012-10-08 11:08:04 +11:00
Con Kolivas
7a01578cc5 Only hand off to stratum from getwork if we succeed in initiating the protocol. 2012-10-06 10:14:30 +10:00
Con Kolivas
ef63ea3151 Drop stratum connect failed message to verbose level only since it's a regular probing message. 2012-10-05 12:45:07 +10:00
Con Kolivas
fa444294bf TCP Keepalive in curl is only in very recent versions and not required with regular messages on stratum anyway. 2012-10-05 12:41:59 +10:00
Con Kolivas
a8d693029a Move stratum sockets to curl infrastructure with locking around send+recv to begin support for proxies and ssl. 2012-10-05 12:37:29 +10:00
Con Kolivas
deb0a9b644 Windows doesn't work with MSG_PEEK on recv so move to a continuously updating buffer for incoming messages. 2012-10-04 23:18:33 +10:00
Con Kolivas
77c5a006aa Alloca is unreliable on windows so use static arrays in util.c stratum code. 2012-10-04 21:00:32 +10:00
Con Kolivas
c113534feb Begin support for mingw stratum build.
Conflicts:
	configure.ac
2012-10-04 17:52:35 +10:00
Con Kolivas
2fae906440 Don't try to parse unneeded parameters in response to mining.subscribe. 2012-10-03 21:10:30 +10:00
Con Kolivas
9698858abc Remove the sshare hash entry if we failed to send it. 2012-10-03 18:19:31 +10:00
Con Kolivas
3cb373d692 Change notify message to info level to avoid spamming repeatedly when a pool is down. 2012-10-03 12:01:29 +10:00
Con Kolivas
1b7aa48c8f Initiate stratum the first time in pool_active only, allowing us to switch to it on getting a failed getwork and detecting the presence of stratum on the url at that time. 2012-10-02 11:46:48 +10:00
Con Kolivas
d122a789ed Use 5 second timeout on sock full for now as a temporary workaround. 2012-10-02 10:19:45 +10:00
Con Kolivas
d851bf3d65 Revert "Don't wait on select when first detecting stratum, just receive one line."
This reverts commit 496af92afd.

Not quite right.
2012-10-02 10:10:52 +10:00
Con Kolivas
496af92afd Don't wait on select when first detecting stratum, just receive one line. 2012-10-02 10:06:37 +10:00
Con Kolivas
bbb092e0da Make the stratum recv buffer larger than the recvsize. 2012-10-02 09:08:47 +10:00
Con Kolivas
2941febd05 Store a sockaddr url of the stripped url used in determining sockaddr to not confuse it with the stratum url and fix build warnings. 2012-10-02 00:00:55 +10:00
Con Kolivas
eaf7ed0dcd Detect if a getwork based pool has the X-Stratum header on startup, and if so, switch to the stratum based pool. 2012-10-01 22:13:20 +10:00
Con Kolivas
b5617734fa Provide locking around stratum send operations to avoid races. 2012-09-30 23:10:43 +10:00
Con Kolivas
8baac0d66d Submit shares from stratum through the abstracted submit share function detecting what message they belong to and showing the data from the associated work, and then deleting it from the hash. 2012-09-30 23:03:45 +10:00
Con Kolivas
fa4c9bf60f Use a more robust mechanism to obtain a \n terminated string over a socket. 2012-09-30 22:40:41 +10:00
Con Kolivas
2de951518e Abstract out share submit as a function to be useable by stratum. 2012-09-30 20:24:24 +10:00
Con Kolivas
739cba28a7 Rename parse_stratum to parse_method as it is only for stratum messages that contain methods. 2012-09-30 19:19:46 +10:00
Con Kolivas
9180a557c3 Count each stratum notify as a getwork equivalent. 2012-09-30 19:11:22 +10:00
Con Kolivas
aa6aa29c4d Check that stratum is already active in initiate_stratum to avoid de-authorising ourselves by subscribing again. 2012-09-29 17:06:48 +10:00
Con Kolivas
7415d7aaa0 Begin implementing a hash database of submissions and attempt sending results. 2012-09-29 16:10:13 +10:00
Con Kolivas
ac47f7f3a6 Store and display stripped url in its own variable. 2012-09-29 14:16:16 +10:00
Con Kolivas
636f4b14d7 Generate the work target in gen_stratum_work, setting default diff to 1 in case it is not yet set. 2012-09-29 11:38:52 +10:00
Con Kolivas
1f6fe55152 Generate the coinbase for generation of stratum based work. 2012-09-29 02:16:22 +10:00
Con Kolivas
1f64491f62 The number of transactions is variable so make merkle a variable length dynamically allocated array and track how many there are for stratum. 2012-09-29 01:48:01 +10:00
Con Kolivas
1221a80d41 Rename nonce2 to n2size reflecting that it's a size variable and not the actual nonce. 2012-09-29 01:03:23 +10:00
Con Kolivas
56255a0c86 Create a stratum thread per pool that has stratum that monitors the socket and serves received data. 2012-09-28 18:01:33 +10:00
Con Kolivas
31c3759ecd Check return value of stratum_parse. 2012-09-28 10:37:42 +10:00
Con Kolivas
ac9a4378d1 Complete authorisation in stratum. 2012-09-28 10:31:45 +10:00
Con Kolivas
331026595f Implement stratum parsing of notify parameters and storing them in the pool stratum work structure. 2012-09-28 10:18:58 +10:00
Con Kolivas
9d4a44e88e Create helper functions for duplicating json strings to avoid keeping json references in use. 2012-09-28 09:57:42 +10:00
Con Kolivas
b86a893981 Append \n in the sock_send function instead of adding it when constructing json in stratum. 2012-09-28 05:30:36 +10:00
Con Kolivas
d416d22381 Don't keep any json references around with stratum structures. 2012-09-28 05:26:29 +10:00
Con Kolivas
7e2dcc6fff Create parse_stratum function that hands off stratum parameters to other functions to manage pool stratum work struct variables.
Implement mining difficulty setting.
2012-09-28 05:16:52 +10:00
Con Kolivas
a6f1a62220 Create helper functions for checking when a socket is ready to read on and receive a single line at a time.
Begin stratum authorisation process.
2012-09-28 04:35:16 +10:00
Con Kolivas
07e6bd1262 Provide a helper function for reading a single \n terminated string from a socket. 2012-09-27 13:50:05 +10:00
Con Kolivas
f6f43500c0 Detect stratum in common place when adding urls, and use a bool to tell us when it's active. 2012-09-27 09:06:56 +10:00
Con Kolivas
8fd149eec9 Fix warnings. 2012-09-26 16:51:08 +10:00
Con Kolivas
e3f1b02e9a Extract and store various parameters on stratum init confirming successful mining notify. 2012-09-26 16:49:51 +10:00
Con Kolivas
c0de671c4f Use existing socket macros and close the socket on failure in init stratum. 2012-09-26 15:40:26 +10:00
Con Kolivas
a1b17229b8 Initiate stratum and grab first json result. 2012-09-26 15:23:01 +10:00
Con Kolivas
58873c1dfa Get detailed addressinfo from the parsed URL for future raw socket usage when possible. IPV4 only for now. 2012-09-25 20:23:59 +10:00
Con Kolivas
ee3b7865e2 Prepare for getaddrinfo call. 2012-09-25 05:46:07 +10:00
Kano
41dcb10d4c util.c - bug - proxy - no data end condition 2012-09-21 20:55:48 +10:00
Kano
bd3c98aaaf Optional WorkTime details with each Accepted/Rejected work item 2012-09-15 14:04:57 +10:00
Kano
e043f5a5aa bug: remove proxy: from the front of the proxy used 2012-09-12 08:32:00 +10:00
Kano
cef9731fbc CURL support for individual proxy per pool and all proxy types 2012-09-12 07:44:00 +10:00
Kano
d5f485c517 Pools: add RollTime info to API 'stats' and 'Stats' button in miner.php 2012-08-23 19:20:12 +10:00
Con Kolivas
8745ba1e6d Windows' timer resolution is limited to 15ms accuracy. This was breaking dynamic intensity since it tries to measure below this.
Since we are repeatedly sampling similar timeframes, we can average the gpu_us result over 5 different values to get very fine precision.
2012-08-15 09:38:45 +10:00
Luke Dashjr
9c648c1749 Bugfix: Calculate nsec in nmsleep correctly
The old algorithm (msecs * 1000000) - (sec / 1000000000) gets total nsec,
including seconds, since the sec/1e9 should be multiplying. It's also
vulnerable to easy overflows. Using ldiv gets the quotient and remainder
in a single operation (at least on x86) and avoids overflow.
2012-07-11 20:10:52 +00:00
Con Kolivas
bc0b14063f Cope with signals interrupting the nanosleep of nmsleep. 2012-07-08 21:35:19 +10:00
Con Kolivas
3271be145f Provide a ms based sleep function that uses nanosleep to avoid the inaccuracy of usleep on SMP systems. 2012-07-06 15:01:39 +10:00
ckolivas
1a43f79547 Mingw doesn't support asprintf, use sprintf. 2012-07-01 12:02:10 +10:00
ckolivas
1e9421475c Timersub is supported on all build platforms so do away with custom timerval_subtract function. 2012-07-01 10:44:23 +10:00
ckolivas
75ea616422 Minor style police on util.c 2012-07-01 10:35:08 +10:00
ckolivas
8f954d40ec Get rid of unused result warning with asprintf. 2012-07-01 10:17:12 +10:00
Con Kolivas
3267b534a8 Implement rudimentary X-Mining-Hashrate support. 2012-06-28 10:43:52 +10:00
ckolivas
c5a21fabf0 Extend nrolltime to support the expiry= parameter. Do this by turning the rolltime bool into an integer set to the expiry time. If the pool supports rolltime but not expiry= then set the expiry time to the standard scantime. 2012-06-23 23:43:22 +10:00
Con Kolivas
268039cc7e Indentation clean up. 2012-04-28 00:32:47 +10:00
Con Kolivas
eda382990a Create one longpoll thread per pool, using backup pools for those pools that don't have longpoll.
Use the work created from the longpoll return only if we don't have failover-enabled, and only flag the work as a longpoll if it is the current pool.
This will work around the problem of trying to restart the single longpoll thread on pool changes that was leading to race conditions.
It will also have less work restarts from the multiple longpolls received from different pools.
2012-04-27 11:58:47 +10:00
Con Kolivas
9609dbc42d Set lp_path to NULL after free for consistency. 2012-04-20 21:09:37 +10:00
nelisky
17b9baa9da Removing dmalloc import left behind by mistake 2012-04-20 03:36:42 -07:00
nelisky
44bcb69ccd Fixing leak in resp_hdr_cb
Memory is allocated for key and val, and longpoll address, when found, is stored in the header_info and prevented from being freed there. This pointer is stored during pool probing but once that's done it was just being lost.

Not so visible but also leaking was the refuse reason string.
2012-04-19 14:45:40 -07:00
Luke Dashjr
ed8382c88d Make curses TUI support optional at compile-time. 2012-03-12 18:38:45 -04:00
Con Kolivas
d1cddf8bad Update licensing to GPL V3. 2012-02-21 22:23:07 +11:00
Con Kolivas
f4284a21a8 Set the lp_sent variable under lock since there will almost always be a race on setting this variable, potentially leading to multiple LPs being sent
out.
2012-02-21 09:22:04 +11:00
Con Kolivas
fe4b5e1fc6 Set the lp_sent bool earlier to minimise the number of extra longpolls sent out. 2012-02-20 08:26:46 +11:00
Con Kolivas
39906718d2 Keep track of when a longpoll has been sent for a pool and if the current pool is requesting work but has not sent a longpoll request, convert one of
the work items to a longpoll as we may have switched pools but still be using the longpoll from the previous pool.
2012-02-19 22:07:31 +11:00
Con Kolivas
810ad04578 More copyright updates. 2012-02-18 23:16:08 +11:00
Con Kolivas
be9db9ce63 Copyright updates. 2012-02-18 23:00:21 +11:00
Con Kolivas
06721957a0 Freeze the queues on all threads that are sent the pause message to prevent them trying to start up again with saved pings in their queues. 2012-02-18 16:34:06 +11:00
Con Kolivas
3d3a3a2f3a Fix unused warnings on win32. 2012-02-15 21:42:12 +11:00
Luke Dashjr
9631c0b02a Fix initialization warning with jansson 1.3 2012-02-15 21:29:15 +11:00
Con Kolivas
56907db2d6 Fix harmless warnings with -Wsign-compare to allow cgminer to build with -W. 2012-02-12 18:21:30 +11:00
Con Kolivas
111238489f Fix missing field initialisers warnings. 2012-02-12 17:53:50 +11:00
Con Kolivas
07c2ee5317 Put win32 equivalents of nanosleep and sleep into compat.h fixing sleep() for adl.c. 2012-02-12 17:00:44 +11:00
zefir
e0fec35751 modularized logging, support for priority based logging
Functions related to logging are extracted into dedicated source files
for better maintainability.

The existing low-level logging API is extended with a generalized scheme
providing log functions log_{error, warning, notice, info, debug} that
log messages based on a global opt_log_level.

opt_log_level for now is set to LOG_NOTICE and might be modified via
command line options or config files in future releases.
2012-02-11 20:26:25 +01:00
Con Kolivas
405a2120f8 Remove unnecessary check for opt_debug on every invocation of applog at LOG_DEBUG and place the check in applog(). 2012-02-11 20:11:18 +11:00
Con Kolivas
b706da9374 Merge branch 'reject_reason' of https://github.com/luke-jr/cgminer into reject 2012-02-11 14:55:12 +11:00
Con Kolivas
5b4761003c Move from the thread safe localtime_r to regular localtime which is the only one supported on newer pthread libraries on mingw32 to make it compile with
the newer ming. Thread safety is of no importance where localtime is used in this code.
2012-02-09 21:54:23 +11:00
Luke Dashjr
f7a9897e13 Display X-Reject-Reason, when provided 2012-02-06 09:44:42 -05:00
Con Kolivas
de4c6c29d7 Provide support for the submitold extension on a per-pool basis based on the value being detected in a longpoll. 2012-02-06 18:12:22 +11:00
Con Kolivas
e57ac0177f Remove unused get_dondata function. 2012-02-05 22:43:42 +11:00
Con Kolivas
36d2fa485c Silence unused parameter warnings. 2012-02-05 22:39:28 +11:00
ckolivas
13fa5772ad Probe but don't set the timeout to 15 seconds as some networks take a long time to timeout. 2012-02-04 20:04:49 +11:00
ckolivas
1832b20c40 Revert "Some networks can take a long time to resolve so go back to 60 second timeouts instead of 15."
This reverts commit c86a670ce6.

This changed more than just the timeout.
2012-02-04 20:04:07 +11:00
ckolivas
c86a670ce6 Some networks can take a long time to resolve so go back to 60 second timeouts instead of 15. 2012-02-04 13:06:04 +11:00
Con Kolivas
bdec295fee Set the latest network access time on share submission for --net-delay even if we're not delaying that submission for further network access. 2012-01-30 17:58:22 +11:00
Kano
b188157c2f Resume advertising midstate support 2012-01-30 16:43:14 +11:00
Con Kolivas
3de7c7f9c2 Stop advertising midstate support until it's fixed. 2012-01-30 15:51:46 +11:00
Con Kolivas
09184720c2 As share submission is usually staggered, and delays can be costly, submit shares without delay even when --net-delay is enabled. 2012-01-30 15:09:58 +11:00
Con Kolivas
82af288e69 Revert "Fix various harmless warnings."
This reverts commit a4b67f030f.
2012-01-29 22:57:29 +11:00
Con Kolivas
a4b67f030f Fix various harmless warnings. 2012-01-29 21:06:17 +11:00
Luke Dashjr
fe88648e5d Advertise longpoll support in X-Mining-Extensions 2012-01-26 23:32:50 +11:00
Con Kolivas
6442c1aba0 Style police. 2012-01-22 20:36:57 +11:00
Midnight Magic
21633b9bee Bringing back TCP_NODELAY, but also ensuring it doesn't conflict with
--net-delay : Nagle's may infact delay some packets longer than
necessary..
2012-01-22 01:07:53 -08:00
Con Kolivas
e15d57d729 Implement socks4 proxy support. 2012-01-22 09:36:21 +11:00
Con Kolivas
5179d22463 Introduce a --net-delay option which guarantees at least 250ms between any networking requests to not overload slow routers. 2012-01-20 15:36:42 +11:00
Luke Dashjr
ebe21db3dc Advertise that we can make our own midstate, so the pool can skip generating it for us 2012-01-17 22:05:20 -05:00
Con Kolivas
4cf433c917 Remove TCP_NODELAY from curl options as many small packets may be contributing to network overload. 2012-01-17 16:21:08 +11:00
Con Kolivas
638c8c526f Make curl use a fresh connection if the json rpc call fails for any reason in case curl is relying on dead persistent connections. 2012-01-01 14:21:22 +11:00
Con Kolivas
19e373b803 All threads are detached so there is no need to join them and it may dereference causing crash on exit. 2011-12-30 11:31:16 +11:00
Kano
5033dcd355 fix test/set of thr->pth to also work in windows 2011-12-27 18:33:49 +11:00
Con Kolivas
2257b5023a Simplify longpoll changeover to just check which pool it should grab its next longpoll from. This should prevent locking hangs and thread cancellation
crashes.
2011-12-27 11:40:53 +11:00
Con Kolivas
a51514d9d1 White space cleanup. 2011-12-27 10:30:04 +11:00
Con Kolivas
b69aa23470 Use control_lock to protect thr->pth for thread creation/destruction. 2011-12-26 10:50:00 +11:00
Con Kolivas
59293a37d6 Only pthread_join when pthread_cancel does not return an error. 2011-12-26 09:29:16 +11:00
Con Kolivas
13c40f753b Zero all pthread_t identities upon cancelling threads. 2011-12-25 00:06:25 +11:00
Con Kolivas
689f8abbaa Try to use SSL if the server supports it. 2011-10-09 12:33:54 +11:00
Con Kolivas
4128b954a6 Add a --donation feature which reads a url/userpass from the author's site and contributes a percentage of getworks to the author, but default to off. 2011-09-27 11:02:45 +10:00
Kano
8ecd15a616 Add BLOCK! notification and remove end of line blanks when not needed 2011-09-20 16:19:21 +10:00
Con Kolivas
b8ea0dd194 Update curses logging to allow LOG_WARNING and LOG_ERR messages to still go through while within the menu, and drop share message to LOG_NOTICE. 2011-09-17 13:25:04 +10:00
Con Kolivas
8e2becc12d Change pth from being a pointer as we can dereference if we're unlucky on stopping longpoll. 2011-09-15 11:46:17 +10:00
Con Kolivas
833e020dfd Standardise the way all non-mining threads are destroyed to make sure we can safely cancel them, freeing ram and NULLifying pointers. 2011-09-15 10:34:59 +10:00
Luke Dashjr
1f15d7eafa Advertise rollntime extension support
Thanks to raijin for testing!
2011-09-10 09:24:33 +10:00
Con Kolivas
a0a5858d15 Use the presence of X-Roll-Ntime in the header as a bool for exists unless N is found in the response. 2011-09-06 12:00:40 +10:00
Con Kolivas
5d845f2fb1 If curl does not have sockopts, do not try to compile the json_rpc_call_sockopt_cb function, making it possible to build against older curl libraries. 2011-09-02 10:13:33 +10:00
Con Kolivas
a593afdbeb Use the curses_lock to protect the curses_active variable and test it under lock. 2011-08-31 13:23:36 +10:00
Con Kolivas
437d6f05cc Disable curl debugging with opt protocol since it spews to stderr. 2011-08-26 13:32:41 +10:00
Con Kolivas
91a2e7012b Actually check the value returned for the x-roll-ntime extension to make sure it isn't saying N. 2011-08-26 12:12:54 +10:00
Con Kolivas
666fcc3f55 Move staged threads to hashes so we can sort them by time. 2011-08-24 12:51:38 +10:00
Con Kolivas
dfec430cb8 Make the tcp setsockopts unique to linux in the hope it allows freebsd et. al to compile. 2011-08-22 08:05:21 +10:00
Con Kolivas
d89a6c57b1 Since we check roll time per work item now, it need only be debug log level. 2011-08-18 21:35:05 +10:00
Con Kolivas
3edc1dfe2a Test at appropriate target difficulty now. 2011-08-17 22:33:46 +10:00
Con Kolivas
1e77f04481 Clean up the longpoll management to ensure the right paths go to the right pool and display whether we're connected to LP or not in the status line. 2011-08-17 12:43:39 +10:00
Con Kolivas
426f72dec7 As we have keepalives now, blaming network flakiness on timeouts appears to have been wrong.
Set a timeout for longpoll to 1 hour, and most other network connectivity to 1 minute.
2011-08-16 10:27:19 +10:00
Con Kolivas
657812ada4 Probe for slightly longer for when network conditions are lagging. 2011-08-16 10:15:47 +10:00
Con Kolivas
d6dd5d700b Test each work item to see if it can be rolled instead of per-pool and roll whenever possible, adhering to the 60 second timeout. 2011-08-14 01:54:47 +10:00
Con Kolivas
5f667e7eab Get rid of extra line feeds. 2011-07-30 13:36:08 +10:00
Con Kolivas
53e05c6413 Log to the output file at any time with warnings and errors, instead of just when verbose mode is on. 2011-07-28 19:55:54 +10:00
Con Kolivas
0006eb2da4 Make the "quiet" mode still update the status and display errors, and add a new --real-quiet option which disables all output and can be set once while running. 2011-07-28 10:36:48 +10:00
Con Kolivas
e82e390295 If work has been cloned it is already at the head of the list and when being reinserted into the queue it should be placed back at the head of the list. 2011-07-27 16:40:52 +10:00
Con Kolivas
98f609b5be Sanity check to prove locking. 2011-07-27 10:31:44 +10:00
Con Kolivas
a187fe1e7b Try to do every curses manipulation under the curses lock. 2011-07-25 13:00:44 +10:00
Con Kolivas
5f54e164c9 Only use the sockoptfunction if the version of curl is recent enough. 2011-07-25 10:58:32 +10:00
Con Kolivas
401983136c Do away with GET for dealing with longpoll forever. POST is the one that works everywhere, not the other way around. 2011-07-24 17:34:57 +10:00
Ycros
0c25ff8416 OSX: fix setsockopt compile bug 2011-07-23 17:11:16 +10:00
Ycros
d37c3fe56b Win32 threading and longpoll keepalive fixes. 2011-07-22 23:43:26 +10:00
Con Kolivas
fe8b041654 Make --no-longpoll work again. 2011-07-22 12:22:55 +10:00
Con Kolivas
b0a8f279f7 Implement the ability to live add, enable, disable, and switch to pools. 2011-07-22 11:46:26 +10:00
Michael Kedzierski
d987006cd8 TCP KEEPALIVE support for long polling. 2011-07-20 23:48:06 +10:00
Con Kolivas
b56ed74867 When json rpc errors occur they occur in spits and starts, so trying to limit them with the comms error bool doesn't stop a flood of them appearing. Make the json errors LOG_INFO level instead so they don't normally show up. 2011-07-19 23:06:11 +10:00
Con Kolivas
81ff7fb3dc Explicitly probe each pool to see if work can be retrieved from it and what it supports. 2011-07-19 13:01:08 +10:00
Con Kolivas
913e120262 Test for rolltime and save it correctly when testing for longpoll. 2011-07-19 12:29:33 +10:00
Con Kolivas
0ce3df10d2 Store whether each server supports X-Roll-Ntime or not. 2011-07-19 11:45:58 +10:00
Con Kolivas
321c4798d4 Make longpoll switch servers should it not match the current pool. 2011-07-19 10:53:04 +10:00
Con Kolivas
cdc72daed9 Some servers regularly return empty responses. Drop the message from ERR to INFO. 2011-07-19 09:26:23 +10:00
Con Kolivas
44c975be65 Long timeouts are causing reset connections and longpoll can recover if the connection needs to be restarted, so remove the timeout settings. 2011-07-19 01:39:22 +10:00
Con Kolivas
0c253734e1 Provide a control lock around global bools to avoid racing on them. 2011-07-18 10:12:38 +10:00
Con Kolivas
6e30c0701c longpoll seems to work either way with post or get but some servers prefer get so change to httpget. 2011-07-17 14:39:53 +10:00
Con Kolivas
579bd42919 Revert "Change get_work to use a timeout when trying to tq_pop as a sanity failsafe in case of unusual circumstances."
This reverts commit 7b9b078114.

Conflicts:

	util.c

Timeout was a bandaid for other going-idle reasons and never helped. Revert it.
2011-07-15 08:53:05 +10:00
Con Kolivas
c36cc61f64 Ensure we connect at least once successfully before continuing to try to connect. 2011-07-14 22:16:06 +10:00
Con Kolivas
e21e923648 Make the curses interface optional with a new --text-only -T option. 2011-07-14 21:46:22 +10:00
Con Kolivas
e335d5211f Cope with servers that return empty bodies that would otherwise crash jansson. 2011-07-13 09:59:02 +10:00
Con Kolivas
24fa8202a7 Revert "Longpoll is not supposed to use POST and this could be leading to longpoll failures."
This reverts commit ad0be6cfbe.

Wrong fix and probably an inappropriate thing to do anyway.
2011-07-12 22:38:47 +10:00
Con Kolivas
10d66b2437 Fix isatty being undefined. 2011-07-12 19:28:24 +10:00
Con Kolivas
7b9b078114 Change get_work to use a timeout when trying to tq_pop as a sanity failsafe in case of unusual circumstances. 2011-07-12 19:19:00 +10:00
Con Kolivas
ad0be6cfbe Longpoll is not supposed to use POST and this could be leading to longpoll failures. 2011-07-12 17:16:08 +10:00
Con Kolivas
43ef5f5d3f Get rid of the flaky time_lock and use the thread safe localtime_r instead. 2011-07-11 22:45:19 +10:00
Con Kolivas
231cd4fd9e va list needs to be copied as it's invalidated either way. 2011-07-11 22:07:17 +10:00
Con Kolivas
73a864c51c vfprintf invalidates the va args so do it after the curses output. 2011-07-11 21:56:34 +10:00
Con Kolivas
90839cdf5a Implement a completely curses based display and don't output to stderr when log is enabled unless it's redirected away from the terminal. 2011-07-11 13:41:31 +10:00
Con Kolivas
3565634198 Show communication error once only on failure. 2011-07-10 22:32:17 +10:00
Con Kolivas
3d9f244e02 Make all applog at least 80 columns wide obviating the need for spaces at the end of select messages to clear the status line. 2011-07-09 17:30:54 +10:00
Ycros
05355d3c79 Fix occasional crash when performing json rpc calls. 2011-07-09 16:10:35 +10:00
Con Kolivas
bb49287449 Make longpoll aware of when new block detection has detected a new block first and avoid flushing the work queue twice. 2011-07-07 14:29:39 +10:00
Rusty Russell
e2d912eb4a vapplog: new helper function for reporting errors. 2011-07-06 16:44:36 +09:30
Con Kolivas
0f351d8466 Always log warnings and error messages. 2011-07-06 12:57:38 +10:00
Con Kolivas
0a80d4b04d Display the output as a refreshing line and only push continuous log to stderr if desired. 2011-07-05 22:04:54 +10:00
Con Kolivas
af6e7937ca Signal handling in dns lookup code is responsible for libcurl crashes when multithreading.
Disable signal handling and use many curl handles instead, thus making work more asynchronous.
Theoretically a curl can wait forever on a dns lookup with this but it's extremely unlikely.
2011-07-05 10:42:11 +10:00
Con Kolivas
13b43cfad1 Update copyright and authors. 2011-07-04 19:56:27 +10:00
Ycros
9fe2106467 Fixed up using config.h instead of cpuminer-config.h. 2011-07-04 19:56:27 +10:00