mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: fill new port workers and symbol fields
This commit is contained in:
parent
31163c3933
commit
472b4d7635
1 changed files with 19 additions and 3 deletions
|
@ -87,12 +87,17 @@ void db_register_stratum(YAAMP_DB *db)
|
|||
int t = time(NULL);
|
||||
if(!db) return;
|
||||
|
||||
db_query(db, "insert into stratums (pid, time, algo) values (%d, %d, '%s') on duplicate key update time=%d",
|
||||
pid, t, g_current_algo->name, t);
|
||||
db_query(db, "INSERT INTO stratums (pid, time, algo, port) VALUES (%d, %d, '%s', %d) "
|
||||
" ON DUPLICATE KEY UPDATE time=%d, algo='%s', port=%d",
|
||||
pid, t, g_stratum_algo, g_tcp_port,
|
||||
t, g_stratum_algo, g_tcp_port
|
||||
);
|
||||
}
|
||||
|
||||
void db_update_algos(YAAMP_DB *db)
|
||||
{
|
||||
int pid = getpid();
|
||||
//int fds = 0; // todo, sample: ls -l /proc/$PID/fd | grep socket | grep -c .
|
||||
if(!db) return;
|
||||
|
||||
if(g_current_algo->overflow)
|
||||
|
@ -100,9 +105,20 @@ void db_update_algos(YAAMP_DB *db)
|
|||
debuglog("setting overflow\n");
|
||||
g_current_algo->overflow = false;
|
||||
|
||||
db_query(db, "update algos set overflow=true where name='%s'", g_current_algo->name);
|
||||
db_query(db, "UPDATE algos SET overflow=true WHERE name='%s'", g_stratum_algo);
|
||||
}
|
||||
|
||||
char symbol[16] = "NULL\0";
|
||||
if(g_list_coind.count == 1) {
|
||||
if (g_list_coind.first) {
|
||||
CLI li = g_list_coind.first;
|
||||
YAAMP_COIND *coind = (YAAMP_COIND *)li->data;
|
||||
sprintf(symbol,"'%s'", coind->symbol);
|
||||
}
|
||||
}
|
||||
|
||||
db_query(db, "UPDATE stratums SET workers=%d, symbol=%s WHERE pid=%d", g_list_client.count, symbol, pid);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
db_query(db, "select name, profit, rent, factor from algos");
|
||||
|
|
Loading…
Add table
Reference in a new issue