util.c


Log

Author Commit Date CI Message
Con Kolivas ee2a5ae8 2013-08-20T20:46:09 TimeBeginPeriod and TimeEndPeriod do not add significant overhead when run the entire time for cgminer so avoid trying to maintain balanced numbers of them for specific time calls to simplify code.
Con Kolivas eeac9d81 2013-08-20T19:23:49 Replace all references to the old n*sleep functions with the equivalent cgsleep_*s replacements.
Con Kolivas 7d448cd7 2013-08-19T23:39:49 timeGetTime uses huge resources on windows so revert to using timevals for its implementation of cgtimer_t
Con Kolivas 0414bf09 2013-08-19T21:36:00 Quotient/remainder error in ms division.
Con Kolivas b238139c 2013-08-19T17:44:45 Provide cgtimer_to_timeval helper functions.
Con Kolivas 09679e9f 2013-08-19T17:38:20 Provide a timeval_to_cgtime helper function to reuse values.
Con Kolivas 09e9091d 2013-08-19T13:54:56 Simplify cgsleep code for windows by using a typedef for cgtimer_t that resolves to clock resolution, using that internally.
Con Kolivas 404cbdea 2013-08-19T13:29:23 On windows use the higher accuracy timegettime function to really get 1ms clock and timer accuracy.
Con Kolivas ffa12a13 2013-08-18T14:35:01 Fix missed endtimeperiod in overrun timer on windows.
Con Kolivas ad87db07 2013-08-18T14:30:54 Make cgsleep_us_r take an int64_t for us.
Con Kolivas 703c7309 2013-08-18T14:26:41 Make the cgsleep functions build on windows.
Con Kolivas 81144732 2013-08-18T11:39:09 Set high resolution timing on windows within the cgsleep functions.
Con Kolivas 621eb003 2013-08-18T10:49:52 Provide reentrant versions of cgsleep functions to allow start time to be set separately from the beginning of the actual sleep, allowing scheduling delays to be counted in the sleep.
Con Kolivas 0b5edb24 2013-08-18T10:36:25 Make the nmsleep and nusleep functions use the new cgsleep functions internally till functions are migrated to the new cgsleep API.
Con Kolivas 188210a3 2013-08-18T10:28:28 Add a ms_to_timespec helper function, and create a cgsleep_ms function that uses absolute timers with clock_nanosleep to avoid overruns.
Con Kolivas 99cbf09d 2013-08-18T00:38:29 Add a timeraddspec helper function.
Con Kolivas 1bcd9a43 2013-08-18T00:34:01 Provide a us_to_timespec helper function.
Con Kolivas 2278204d 2013-08-18T00:27:33 Provide a us_to_timeval helper function.
Con Kolivas a6b1c317 2013-08-18T00:19:47 Add helper functions to convert timespec to timeval and vice versa.
Con Kolivas e95ad047 2013-08-13T22:44:22 Nonce2 stratum submission is not working with nonce2 lengths >4, revert the buggy __bin2hex function and use bin2hex.
Con Kolivas 87ae66c7 2013-08-13T05:49:32 Create a work data template when receiving stratum notification, allowing a simple memcpy of the merkle root avoiding more hex2bin conversions on each work generation.
Con Kolivas 46b6b07a 2013-08-12T16:02:20 Avoid a potential overflow should a pool specify a large nonce2 length with stratum.
Con Kolivas 5237bf35 2013-08-12T11:36:28 Perform merkle bin hex2bin on stratum notify to avoid doing it on each work generation.
Con Kolivas 8bc469e9 2013-08-12T11:16:46 Reuse just the one pool coinbase variable in stratum, avoiding more string functions and storage in gen_stratum_work on each work generation.
Con Kolivas c542e47a 2013-08-12T10:49:38 Use a nonce2 offset variable for both gbt and stratum to consolidate requirements on work generation.
Kano eca6ace2 2013-08-12T09:00:52 util.c update quit call for new functions
Kano bab9ba96 2013-08-12T08:58:20 use correct define for OSX in util.c
Kano bd3612c1 2013-08-12T08:38:02 util.c expand quit to show file/func/line
Kano cf300537 2013-08-12T08:35:29 Merge remote-tracking branch 'conman/master'
Con Kolivas b423fe9d 2013-08-11T14:06:17 Cache the hex2bin of pool nonce1 in stratum, avoiding hex2bin on each work generation.
Con Kolivas fef649df 2013-08-11T13:47:46 Cache the binary generation of coinbase1 and 2 on stratum, avoiding a hex2bin of coinbase1 and 2 on each work generation.
Kano 48d91c7f 2013-08-10T10:36:38 cgsem - increase information on failure
ckolivas eb9278ca 2013-07-19T19:32:57 Check for negative wait time in socket_full.
ckolivas f2ae7fad 2013-07-19T19:09:23 Adjust socket wait timeout in recv_line according to how long we've already waited to avoid a 60 second wait dropping to 1 second due to a blocked socket.
Con Kolivas 1b5ea442 2013-06-21T18:02:38 Show an integer only for diff if it is one.
Con Kolivas 6560878e 2013-06-16T22:33:49 Suspend stratum connections when we know they've failed and don't try to recv data from them once the socket no longer exists.
Con Kolivas 13a4aaa6 2013-06-13T14:31:37 Failure to read and write on pseudo semaphores on apple happens routinely on shut down so should not be a quit error, just a warning.
Con Kolivas 12a2cb0d 2013-06-09T22:37:49 Demote failed hex2bin result to LOG_INFO and check return result in driver-bflsc to avoid doing find_work_by_midstate.
ckolivas 9b2e517f 2013-06-09T12:20:04 Use cgsem structures instead of the flaky pings in the work queue to start mining threads and remove the unused thr_info_freeze function.
ckolivas 104b14ec 2013-06-06T13:22:12 Failed reads and writes on cgsem_post and cgsem_wait should be extremely rare.
ckolivas b59c3380 2013-06-06T13:08:00 Implement cgminer specific cgsem semaphores to imitate unnamed semaphore behaviour on osx which does not support them.
Con Kolivas d52ab244 2013-05-28T23:00:14 Provide an nusleep equivalent function to nmsleep.
Con Kolivas 64b08f38 2013-05-19T10:23:59 All stratum calls to recv_line are serialised from the one place so there is no need to use locking around recv().
Con Kolivas f227515e 2013-05-18T13:09:01 Set pool->probed to true after an attempt to resolve the url via stratum code.
Con Kolivas 3336880e 2013-05-13T22:42:39 Show pool difficulty more verbosely if it changes via stratum.
mhren c5bfc452 2013-05-11T23:32:57 Update util.c Apple OS/X does not define MSG_NOSIGNAL. Use SO_NOSIGPIPE instead
Con Kolivas 3972fe22 2013-05-11T15:03:40 Show a different warning and loglevel for failure to resolve a URL on first or subsequent testing of stratum pool URLs.
Con Kolivas 2645797f 2013-05-09T22:04:33 Set all stratum sockets to nonblocking to avoid trying to use MSG_DONTWAIT on windows.
Con Kolivas d89936a9 2013-05-09T21:10:53 Fix warnings on win32 build.
ckolivas 832012f6 2013-05-09T13:42:53 Only use MSG_NOSIGNAL for !win32 since it doesn't exist on windows.
ckolivas 6acfdbd6 2013-05-09T13:36:34 Use MSG_NOSIGNAL on stratum send()
ckolivas a7cbbc9f 2013-05-09T12:08:42 Set TCP_NODELAY for !linux for raw sockets.
ckolivas 0676a1a8 2013-05-09T12:00:28 Use TCP_NODELAY with raw sockets if !opt_delaynet
Con Kolivas 68196588 2013-05-09T11:39:09 Make raw sockets compile on windows
Con Kolivas 43bcccf8 2013-05-09T10:41:27 Recheck select succeeds on EWOULDBLOCK for stratum.
Con Kolivas 6e969e93 2013-05-08T22:52:18 Recv() should all be non-blocking for raw sockets in stratum.
Con Kolivas cf80fe4a 2013-05-08T22:41:28 Change verbosity and error for getaddrinfo warnings in setup stratum socket.
Con Kolivas 1a43cb0b 2013-05-08T22:11:01 Free servinfo after p is checked in setup stratum socket.
Con Kolivas 31aa4f6c 2013-05-08T21:59:58 Use raw sockets without curl for stratum communications.
Con Kolivas 657e6447 2013-05-08T06:28:07 Sacrifice curl handle memory on stratum disconnects on all versions of libcurl to avoid curl corruption.
Con Kolivas 891f88b6 2013-05-06T16:54:55 Don't use TCP_NODELAY if opt_delaynet is enabled with stratum.
Kano 2ce2f8d8 2013-05-02T23:36:04 util correct applog typing
Kano 863c9e27 2013-04-26T14:49:10 util.c str_text make a fully text readable version of str
Con Kolivas d835ef75 2013-04-24T23:16:21 Receive failures in recv_line should unconditionally fail.
Con Kolivas 06f7f525 2013-04-24T23:14:41 Revert "Add more debugging to recv_line parse failure." This reverts commit b615502b2b68571a2574568fa838d82b173f6c24. Unnecessary.
Con Kolivas af60a19d 2013-04-24T23:07:42 Use sock_blocks function for stratum send and receive.
Con Kolivas 181cb163 2013-04-24T21:26:44 There should be no error response code with return value 0 in recv_line.
Con Kolivas b615502b 2013-04-24T21:14:20 Add more debugging to recv_line parse failure.
Con Kolivas e95695db 2013-04-24T20:44:41 Check for errors on stratum recv for any recv return value less than 1 and only parse the response if it's positive.
James Z.M. Gao e00a1b0e 2013-04-22T11:19:15 compile on win32
Con Kolivas d2abaa83 2013-04-22T10:49:10 Provide wrappers for commonly used timer routines with API stats.
Con Kolivas 3cc42231 2013-04-22T09:53:34 Fulltest is true if value is <= target.
Con Kolivas 3c61a51e 2013-04-22T09:48:41 Use system host to endian functions for clarity in fulltest.
Con Kolivas 3d7f8243 2013-04-21T19:02:44 Create a cgminer specific gettimeofday wrapper that is always called with tz set to NULL and increases the resolution on windows.
Con Kolivas 3b5ef343 2013-04-21T18:01:49 Add high resolution to nmsleep wrapper on windows.
Con Kolivas 36bb133e 2013-04-15T12:34:34 Cleanup when stratum curl fails to initialise.
Con Kolivas 81549c5b 2013-04-15T12:16:05 Avoid applog in recalloc_sock.
Con Kolivas 69c203d8 2013-04-15T12:07:52 Avoid applog under stratum_lock in recv_line.
Con Kolivas e4effc37 2013-04-15T12:01:24 Avoid applog under stratum_lock in __stratum_send.
Con Kolivas d248e7aa 2013-04-15T11:50:59 Put spacing around locking in util.c for clarity.
Con Kolivas c1ec55a6 2013-04-09T07:08:09 Avoid curl_easy_cleanup on old curl versions in setup_stratum_curl as well.
Con Kolivas 1e14748c 2013-04-06T15:49:55 Small timeouts on select() instead of instant timeout increase reliability of socket reads and writes.
Con Kolivas ae4ee34a 2013-04-06T15:49:55 Small timeouts on select() instead of instant timeout increase reliability of socket reads and writes.
Con Kolivas c6ca12f0 2013-04-06T11:21:55 Differentiate socket closed from socket error in recv_line.
Con Kolivas 2f89eef4 2013-04-06T11:21:55 Differentiate socket closed from socket error in recv_line.
Con Kolivas b6e3d5b4 2013-03-14T22:34:53 Make pool adding while running asynchronous, using the pool test thread functionality.
Con Kolivas 1a74bc56 2013-03-14T22:08:19 Only curl easy cleanup a stratum curl if it exists.
Con Kolivas 195ea635 2013-03-14T22:05:42 Sacrifice the ram of curl handles in stratum disconnects when we have built with old libcurl to avoid crashes.
Con Kolivas 26ddd1fd 2013-03-12T22:31:45 Move the stratum and GBT data to be protected under a new cg_lock data_lock.
Con Kolivas 66c567ab 2013-03-09T12:13:12 Use curl_easy_cleanup to close any open stratum sockets.
Con Kolivas 7e3ca570 2013-03-09T10:41:36 Set sockd to false should curl setup fail on stratum.
Con Kolivas 56068d68 2013-03-09T10:30:58 Close any open sockets when reusing a curl handle and reopen the socket whenever we're retrying stratum.
Con Kolivas 09c02b1c 2013-03-07T22:02:51 Shorten the time before keepalive probes are sent out and how frequently they're sent with stratum curls.
Con Kolivas 501f4cd6 2013-03-07T19:59:30 Clear the socket of anything in the receive buffer if we're going to retry connecting.
Con Kolivas c9b4f5c7 2013-03-07T15:34:44 Revert "Cope with out of order messages coming in upon attempting to auth_stratum." This reverts commit 237f67c6178bd8f4c5e9f807cdf9a010d17e9684.
Con Kolivas ed903ddf 2013-03-07T15:13:32 Clear just the socket buffer when we don't care what is left in a stratum socket.
Con Kolivas fbb25c4b 2013-03-07T15:10:38 Clear the stratum socket whenever we are closing it since the buffer is going to be reused.
Con Kolivas 0810212c 2013-03-07T14:20:33 Reset stratum_notify flag on suspend_stratum as well.
Con Kolivas 07ae6172 2013-03-07T14:15:28 Close any sockets opened if we fail to initiate stratum but have opened the socket.
Con Kolivas 6875dc46 2013-03-07T13:50:25 Close any existing stratum socket if we are attempting to restart stratum so the pool knows the connection has gone.