util.c


Log

Author Commit Date CI Message
Con Kolivas e1387dc8 2012-12-29T11:29:59 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.
Con Kolivas 6e2e7d36 2012-12-29T10:46:55 Differentiate socket full from sock full.
Con Kolivas 7f46f6e9 2012-12-29T10:42:45 Allow stratum to startup without notify but check it is valid before creating stratum work.
Con Kolivas e1d7ecdd 2012-12-29T09:45:40 Do not try to generate stratum work unless the notify command has succeeded.
Con Kolivas 944af31b 2012-12-26T09:31:41 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.
Con Kolivas cada0d31 2012-12-14T21:36:42 Check for EWOULDBLOCK when supported in send and recv as well.
Con Kolivas 2274af6a 2012-12-14T21:29:33 Use the raw send() command instead of curl_easy_send since curl raw socket usage introduces random bugs on windows.
Con Kolivas f66d59df 2012-12-14T21:20:52 Use raw recv() command in place of curl_easy_recv since the curl implementation introduces random bugs on windows builds when the recv fails.
Kano 138465bf 2012-12-13T00:56:10 Pool store data transfer stats
Con Kolivas ac3020f4 2012-12-10T21:55:28 Include prctl header for thread renaming to work.
Con Kolivas 15e5e36b 2012-12-09T14:13:24 Return value of keep_sockalive is no longer used.
Con Kolivas 8fcc67f3 2012-12-09T13:39:37 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.
Con Kolivas 68f1b2c4 2012-12-08T22:14:47 Set successful connect to true on auth stratum to allow summary on exit from single stratum pool.
Con Kolivas be013e96 2012-12-07T09:36:22 Set pool probed to true on successful authorisation with stratum to avoid it being pinged later with pool_getswork.
Con Kolivas fc5d3a0e 2012-12-03T09:52:46 Suspend stratum connections to backup pools when there is no requirement to potentially grab work from them.
Denis Ahrens 271b05ab 2012-12-02T11:39:20 setting the name of the threads for linux,freebsd,openbsd and osx code is borrowed from bitcoins util.c, so it is already tested
Con Kolivas fc66a41e 2012-12-02T20:49:40 Style police.
Con Kolivas f94cff77 2012-12-02T18:06:55 Microoptimise and remove redundant copy of strdup function in calloc_strcat.
Con Kolivas 0ae02c6e 2012-12-01T08:26:31 Since we will be using calloc_str to put a string into it, convert the function to calloc_strcat which does it automatically.
Con Kolivas ee8609d9 2012-11-29T12:48:17 Provide helper functions calloc_str and realloc_strcat to create and extend arbitrary length arrays based on string length.
nelisky 6db7e2e5 2012-11-24T13:11:07 fixes target calc for mips openwrt
Con Kolivas 0b088d8d 2012-11-18T18:08:14 Provide rudimentary support for literal ipv6 addresses when parsing stratum URLs.
Con Kolivas f14bf5b1 2012-11-17T22:06:49 Merge pull request #326 from pshep/error_counters Error counters
Con Kolivas b3864d1a 2012-11-15T09:18:58 Support for fractional diffs and the classic just-below-1 share all FFs diff target.
Paul Sheppard dad6c704 2012-11-06T09:46:05 Merge branch 'master' into error_counters
Con Kolivas cc7c2745 2012-11-05T16:28:52 Manage appropriate response codes for share submission with GBT.
Paul Sheppard 84173c6c 2012-11-04T20:38:11 missing a break.
Paul Sheppard 9f74e650 2012-11-04T20:13:49 Tidy up device error counts
Luke Dashjr c2b5c5ee 2012-10-29T07:50:47 Bugfix: Free old stratum_work data before replacing it
Con Kolivas c2861d68 2012-10-30T19:22:02 There is no need for addrinfo any more.
ckolivas a2d57835 2012-10-30T16:45:27 server and client sockaddr_in are no longer used in struct pool.
Con Kolivas 48f24223 2012-10-29T12:35:21 Shorten the initiate stratum connect timeout to 30 seconds.
Con Kolivas 6f4c47eb 2012-10-29T11:58:58 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.
Con Kolivas aa97e87a 2012-10-28T09:15:45 Use keepalive with stratum sockets to improve its ability to detect broken connections.
Con Kolivas d9276557 2012-10-27T23:20:10 Show only the URL in the status bar to avoid long prefixes making for extra long lines.
Con Kolivas 6d3c880a 2012-10-22T22:48:12 Make sure to check pool stratum curl exists under lock before attempting any recv to not risk dereferencing upon attempting to reinitiate stratum.
Con Kolivas e575763a 2012-10-22T22:06:00 Avoid redefining macros and align to 4 byte boundaries.
ckolivas bb4bec98 2012-10-17T09:34:32 Use select on stratum send to make sure the socket is writeable.
Con Kolivas 99adf397 2012-10-16T19:47:31 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.
Con Kolivas b3d42589 2012-10-16T19:22:48 Provide locking around the change of the stratum curl structures to avoid possible races.
Con Kolivas e5babfa2 2012-10-15T11:40:32 Watch for buffer overflows on receiving data into the socket buffer.
Con Kolivas 2a9b3e33 2012-10-14T09:54:04 String alignment to 4 byte boundaries and optimisations for bin<->hex conversions.
Con Kolivas fc72ad55 2012-10-12T14:57:42 Off by one error.
Con Kolivas 9ccfcee6 2012-10-12T14:55:52 Prevent overflows of the port char array in extract_sockaddr.
ckolivas 7f522ef8 2012-10-11T14:23:09 Add support for client.get_version for stratum.
Con Kolivas a533f106 2012-10-11T00:08:45 Update reconnect message to show whole address including port.
Con Kolivas 5226a399 2012-10-11T00:06:44 Look for null values and parse correct separate array entries for url and port with client reconnect commands for stratum.
Con Kolivas 7c04a00e 2012-10-10T23:56:24 The command for stratum is client.reconnect, not mining.reconnect.
Con Kolivas 783af876 2012-10-10T23:41:29 Implement rudimentary mining.reconnect support for stratum.
Con Kolivas 974f65c6 2012-10-10T23:22:24 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.
Con Kolivas 07605fad 2012-10-10T23:07:33 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.
Con Kolivas ef822a25 2012-10-08T11:08:04 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.
Con Kolivas 7a01578c 2012-10-06T10:14:30 Only hand off to stratum from getwork if we succeed in initiating the protocol.
Con Kolivas ef63ea31 2012-10-05T12:45:07 Drop stratum connect failed message to verbose level only since it's a regular probing message.
Con Kolivas fa444294 2012-10-05T12:41:59 TCP Keepalive in curl is only in very recent versions and not required with regular messages on stratum anyway.
Con Kolivas a8d69302 2012-10-05T12:37:29 Move stratum sockets to curl infrastructure with locking around send+recv to begin support for proxies and ssl.
Con Kolivas deb0a9b6 2012-10-04T23:18:33 Windows doesn't work with MSG_PEEK on recv so move to a continuously updating buffer for incoming messages.
Con Kolivas 77c5a006 2012-10-04T21:00:32 Alloca is unreliable on windows so use static arrays in util.c stratum code.
Con Kolivas c113534f 2012-10-04T15:35:28 Begin support for mingw stratum build. Conflicts: configure.ac
Con Kolivas 2fae9064 2012-10-03T21:10:30 Don't try to parse unneeded parameters in response to mining.subscribe.
Con Kolivas 9698858a 2012-10-03T18:19:31 Remove the sshare hash entry if we failed to send it.
Con Kolivas 3cb373d6 2012-10-03T12:01:29 Change notify message to info level to avoid spamming repeatedly when a pool is down.
Con Kolivas 1b7aa48c 2012-10-02T11:46:48 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.
Con Kolivas d122a789 2012-10-02T10:19:45 Use 5 second timeout on sock full for now as a temporary workaround.
Con Kolivas d851bf3d 2012-10-02T10:10:52 Revert "Don't wait on select when first detecting stratum, just receive one line." This reverts commit 496af92afd3e2cfe0d507e7199bc35b17ecee766. Not quite right.
Con Kolivas 496af92a 2012-10-02T10:06:37 Don't wait on select when first detecting stratum, just receive one line.
Con Kolivas bbb092e0 2012-10-02T09:08:47 Make the stratum recv buffer larger than the recvsize.
Con Kolivas 2941febd 2012-10-02T00:00:55 Store a sockaddr url of the stripped url used in determining sockaddr to not confuse it with the stratum url and fix build warnings.
Con Kolivas eaf7ed0d 2012-10-01T22:13:20 Detect if a getwork based pool has the X-Stratum header on startup, and if so, switch to the stratum based pool.
Con Kolivas b5617734 2012-09-30T23:10:43 Provide locking around stratum send operations to avoid races.
Con Kolivas 8baac0d6 2012-09-30T23:03:45 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.
Con Kolivas fa4c9bf6 2012-09-30T22:40:41 Use a more robust mechanism to obtain a \n terminated string over a socket.
Con Kolivas 2de95151 2012-09-30T20:24:24 Abstract out share submit as a function to be useable by stratum.
Con Kolivas 739cba28 2012-09-30T19:19:46 Rename parse_stratum to parse_method as it is only for stratum messages that contain methods.
Con Kolivas 9180a557 2012-09-30T19:11:22 Count each stratum notify as a getwork equivalent.
Con Kolivas aa6aa29c 2012-09-29T17:06:48 Check that stratum is already active in initiate_stratum to avoid de-authorising ourselves by subscribing again.
Con Kolivas 7415d7aa 2012-09-29T16:10:13 Begin implementing a hash database of submissions and attempt sending results.
Con Kolivas ac47f7f3 2012-09-29T14:16:16 Store and display stripped url in its own variable.
Con Kolivas 636f4b14 2012-09-29T11:38:52 Generate the work target in gen_stratum_work, setting default diff to 1 in case it is not yet set.
Con Kolivas 1f6fe551 2012-09-29T02:16:22 Generate the coinbase for generation of stratum based work.
Con Kolivas 1f64491f 2012-09-29T01:48:01 The number of transactions is variable so make merkle a variable length dynamically allocated array and track how many there are for stratum.
Con Kolivas 1221a80d 2012-09-29T01:03:23 Rename nonce2 to n2size reflecting that it's a size variable and not the actual nonce.
Con Kolivas 56255a0c 2012-09-28T18:01:33 Create a stratum thread per pool that has stratum that monitors the socket and serves received data.
Con Kolivas 31c3759e 2012-09-28T10:37:42 Check return value of stratum_parse.
Con Kolivas ac9a4378 2012-09-28T10:31:45 Complete authorisation in stratum.
Con Kolivas 33102659 2012-09-28T10:18:58 Implement stratum parsing of notify parameters and storing them in the pool stratum work structure.
Con Kolivas 9d4a44e8 2012-09-28T09:57:42 Create helper functions for duplicating json strings to avoid keeping json references in use.
Con Kolivas b86a8939 2012-09-28T05:30:36 Append \n in the sock_send function instead of adding it when constructing json in stratum.
Con Kolivas d416d223 2012-09-28T05:26:29 Don't keep any json references around with stratum structures.
Con Kolivas 7e2dcc6f 2012-09-28T05:16:52 Create parse_stratum function that hands off stratum parameters to other functions to manage pool stratum work struct variables. Implement mining difficulty setting.
Con Kolivas a6f1a622 2012-09-28T04:35:16 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.
Con Kolivas 07e6bd12 2012-09-27T13:50:05 Provide a helper function for reading a single \n terminated string from a socket.
Con Kolivas f6f43500 2012-09-27T09:06:56 Detect stratum in common place when adding urls, and use a bool to tell us when it's active.
Con Kolivas 8fd149ee 2012-09-26T16:51:08 Fix warnings.
Con Kolivas e3f1b02e 2012-09-26T16:49:51 Extract and store various parameters on stratum init confirming successful mining notify.
Con Kolivas c0de671c 2012-09-26T15:40:26 Use existing socket macros and close the socket on failure in init stratum.
Con Kolivas a1b17229 2012-09-26T15:23:01 Initiate stratum and grab first json result.
Con Kolivas 58873c1d 2012-09-25T20:23:59 Get detailed addressinfo from the parsed URL for future raw socket usage when possible. IPV4 only for now.
Con Kolivas ee3b7865 2012-09-25T05:46:07 Prepare for getaddrinfo call.
Kano 41dcb10d 2012-09-21T20:55:48 util.c - bug - proxy - no data end condition