mirror of
https://github.com/LBRYFoundation/pool.git
synced 2025-08-23 17:37:25 +00:00
stratum: allow to reopen wiped global logs
can be useful after a logrotate, to avoid restarting the stratums
This commit is contained in:
parent
90e78f772f
commit
c99770a5ae
1 changed files with 13 additions and 3 deletions
|
@ -149,7 +149,11 @@ void clientlog(YAAMP_CLIENT *client, const char *format, ...)
|
||||||
if(g_clientlog)
|
if(g_clientlog)
|
||||||
{
|
{
|
||||||
fprintf(g_clientlog, "%s", buffer3);
|
fprintf(g_clientlog, "%s", buffer3);
|
||||||
fflush(g_clientlog);
|
if (fflush(g_clientlog) == EOF) {
|
||||||
|
// reopen if wiped
|
||||||
|
fclose(g_clientlog);
|
||||||
|
g_clientlog = fopen("client.log", "a");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +223,10 @@ void stratumlog(const char *format, ...)
|
||||||
if(g_stratumlog)
|
if(g_stratumlog)
|
||||||
{
|
{
|
||||||
fprintf(g_stratumlog, "%s: %s", buffer2, buffer);
|
fprintf(g_stratumlog, "%s: %s", buffer2, buffer);
|
||||||
fflush(g_stratumlog);
|
if (fflush(g_stratumlog) == EOF) {
|
||||||
|
fclose(g_stratumlog);
|
||||||
|
g_stratumlog = fopen("stratum.log", "a");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +271,10 @@ void rejectlog(const char *format, ...)
|
||||||
if(g_rejectlog)
|
if(g_rejectlog)
|
||||||
{
|
{
|
||||||
fprintf(g_rejectlog, "%s: %s", buffer2, buffer);
|
fprintf(g_rejectlog, "%s: %s", buffer2, buffer);
|
||||||
fflush(g_rejectlog);
|
if (fflush(g_rejectlog) == EOF) {
|
||||||
|
fclose(g_rejectlog);
|
||||||
|
g_rejectlog = fopen("reject.log", "a");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue