Commit Graph

119 Commits

Author SHA1 Message Date
Con Kolivas
a6fe8f392c Sleep briefly, don't poll when no fds are present 2014-04-28 13:33:40 +10:00
Con Kolivas
c1c5b22058 There is no need to poll every second in the receiver thread 2014-04-27 22:41:07 +10:00
Con Kolivas
5f9b67f82e Avoid re-setting reject reason when sdiff is not calculated 2014-04-27 22:21:12 +10:00
Con Kolivas
7acd1b0c10 Accept the lower of new and old diffs until the next update 2014-04-27 22:16:47 +10:00
Con Kolivas
6a753c149d Clean up block solve notification and messages, sending a work restart immediately 2014-04-27 21:11:10 +10:00
Con Kolivas
0b08bbb43e Add submission of blocksolves 2014-04-27 20:51:09 +10:00
Con Kolivas
2ce326a462 Clamp worker diff to network diff 2014-04-27 16:24:44 +10:00
Con Kolivas
fd7dfc0e8a Check submitted shares against target diff 2014-04-27 16:16:48 +10:00
Con Kolivas
63008c6c0d Start assembling submit data to test its hash difficulty 2014-04-27 14:43:25 +10:00
Con Kolivas
270d540294 Keep workbases around from old blocks but reference when the block change to differentiate stale from invalid Job IDs 2014-04-27 14:10:08 +10:00
Con Kolivas
f038cf4b16 Add support for setting reject-reason in stratum submit parsing 2014-04-27 14:01:35 +10:00
Con Kolivas
ea90d65d30 Round the optimal value for diff 2014-04-27 13:05:57 +10:00
Con Kolivas
c076ad9509 Change target spm to 18 and count hashrate from first share submitted, fixing divide by zero possibility 2014-04-27 12:29:53 +10:00
Con Kolivas
91854f81ec Cope with failure to get a single block template more gracefully 2014-04-27 10:17:38 +10:00
Con Kolivas
4e4ad53e98 Implement diff tracking by job id and vardiff to maintain share submission rate of 20pm 2014-04-27 09:55:30 +10:00
Con Kolivas
e383d6f736 Invalidate workbases from old blocks and reject shares that don't have a matching workbase 2014-04-26 23:28:49 +10:00
Con Kolivas
328a85c1fe Only assume clients have disconnected on an error from recv 2014-04-26 09:13:26 +10:00
Con Kolivas
b6030d3809 Close sockets immediately after every received message in connector and stratifier 2014-04-26 08:54:18 +10:00
Con Kolivas
cecaad4095 Add some sanity checking to params sent with share submission and clear memory used when workbases are dropped 2014-04-26 02:36:34 +10:00
Con Kolivas
9db3db3b8b Enable keepalive and nodelay for remote clients and remove mistaken setting of noblock, and add reuseaddr option to sockets 2014-04-26 02:05:27 +10:00
Con Kolivas
6a7e1bcc37 Add fake submit parsing and poll every second instead of millisecond 2014-04-26 01:25:42 +10:00
Con Kolivas
3bee9efed6 Remove invalidated clients from broadcasts 2014-04-26 01:08:45 +10:00
Con Kolivas
9d73d6b145 Add broadcasting of stratum updates to all authorised users, with further json fixes 2014-04-26 00:46:21 +10:00
Con Kolivas
db5aece42a Fix mining notify json and add basic authorise mechanism 2014-04-25 22:40:41 +10:00
Con Kolivas
2e1a1100d3 Send a stratum parameter update to a client that's just subscribed, caching parameters that will be reused 2014-04-25 21:29:38 +10:00
Con Kolivas
7cf768fddf Cope with the unlikely event we have been requested a mining subscribe before any work templates have been generated 2014-04-25 20:29:35 +10:00
Con Kolivas
4916591ae5 Create response to mining.subscribe request and deny all other invalid requests 2014-04-25 20:27:28 +10:00
Con Kolivas
8be725bde6 Retry binding the connector to the socket for up to 2 minutes 2014-04-25 19:32:24 +10:00
Con Kolivas
7f0824260b Disconnect clients that send invalid json 2014-04-25 19:18:22 +10:00
Con Kolivas
72ebb96ef6 Return a json response to any valid json from the stratifier to connector to send to the relevant connected client 2014-04-25 19:08:53 +10:00
Con Kolivas
126c7964e2 Add a json parser to the stratum receiver that will generate return messages 2014-04-25 18:34:52 +10:00
Con Kolivas
4f0379299a Create new stratum instances for each new client id, adding them to a hashtable 2014-04-25 14:10:50 +10:00
Con Kolivas
df64af6ce4 Add a stratum add sending function for adding messages to send to the linked list 2014-04-25 13:40:07 +10:00
Con Kolivas
04c5de6ad0 Store the latest hash, noting when it changes to allow stratum clean notification 2014-04-25 13:34:21 +10:00
Con Kolivas
080eef5f31 Send and receive stratum messages via their own threads that add and remove client ids to the json using linked lists and pthread conditionals to wake them 2014-04-25 13:18:59 +10:00
Con Kolivas
e946665023 Create stratum receive/send threads that will use their own hashtables and conditionals to do work 2014-04-25 09:30:19 +10:00
Con Kolivas
1b745f0db3 Pass recognised json messages sent to connector to stratifier with the added client_id field 2014-04-24 18:21:09 +10:00
Con Kolivas
718bf11a46 Reference clients by id, not fd since fd can be the same and be invalidated 2014-04-24 17:47:07 +10:00
Con Kolivas
5a0d3f8d24 Create a hashtable of workbases as they're created, removing them if they're older than 10 minutes old 2014-04-24 17:27:51 +10:00
Con Kolivas
438f8c4472 Add the beginnings of a sanity checking client message parser 2014-04-24 16:49:33 +10:00
Con Kolivas
f2b32839c1 Create a client instance hash table and use it to determine which fds need to be polled 2014-04-24 13:48:17 +10:00
Con Kolivas
3c21f90aab Use poll to connect many clients and see which connections need to be read in connector 2014-04-23 16:34:42 +10:00
Con Kolivas
bcbafba42e Create a thread from the connector process that listens for incoming connections and opens new connections for them 2014-04-23 15:17:09 +10:00
Con Kolivas
55b8e8424a Add connector process which will process all remote communications 2014-04-23 14:38:34 +10:00
Con Kolivas
9e92be3f5e Use a longer timeout for reading a socket line, along with a select timeout on each loop through the read function to increase reliability over network connections 2014-04-23 13:12:36 +10:00
Con Kolivas
4ab9120e61 Handle failed generator startup as a fatal startup, sending listener a shutdown message and adding shutdown parsing 2014-04-23 13:07:04 +10:00
Con Kolivas
2b1f9510cf Add a block update thread that polls bitcoind regularly for the latest hash and handle failed json requests as closed sockets 2014-04-23 09:51:56 +10:00
Con Kolivas
8f0958bbfb Add some default parameters to make polling intervals configurable 2014-04-22 22:03:48 +10:00
Con Kolivas
2bcdc4bcce Cache the header binary that will be used for work reconstruction 2014-04-22 16:04:23 +10:00
Con Kolivas
86159a60ec Generate coinbase templates, fixing missing fields from gbt parser 2014-04-22 15:12:49 +10:00