Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
azure-cloud-mining-script
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
azure-cloud-mining-script
Commits
1b4f0dd5
There was an error fetching the commit references. Please try again later.
Commit
1b4f0dd5
authored
8 years ago
by
fireice-uk
Browse files
Options
Downloads
Patches
Plain Diff
Giveup limit
parent
433db191
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
config.txt
+3
-0
3 additions, 0 deletions
config.txt
executor.cpp
+13
-1
13 additions, 1 deletion
executor.cpp
executor.h
+2
-0
2 additions, 0 deletions
executor.h
jconf.cpp
+12
-3
12 additions, 3 deletions
jconf.cpp
jconf.h
+1
-0
1 addition, 0 deletions
jconf.h
with
31 additions
and
4 deletions
config.txt
+
3
−
0
View file @
1b4f0dd5
...
...
@@ -110,9 +110,12 @@
* call_timeout - How long should we wait for a response from the server before we assume it is dead and drop the connection.
* retry_time - How long should we wait before another connection attempt.
* Both values are in seconds.
* giveup_limit - Limit how many times we try to reconnect to the pool. Zero means no limit. Note that stak miners
* don't mine while the connection is lost, so your computer's power usage goes down to idle.
*/
"call_timeout" : 10,
"retry_time" : 10,
"giveup_limit" : 0,
/*
* Output control.
...
...
This diff is collapsed.
Click to expand it.
executor.cpp
+
13
−
1
View file @
1b4f0dd5
...
...
@@ -96,8 +96,17 @@ void executor::ex_clock_thd()
void
executor
::
sched_reconnect
()
{
iReconnectAttempts
++
;
size_t
iLimit
=
jconf
::
inst
()
->
GetGiveUpLimit
();
if
(
iLimit
!=
0
&&
iReconnectAttempts
>
iLimit
)
{
printer
::
inst
()
->
print_msg
(
L0
,
"Give up limit reached. Exitting."
);
exit
(
0
);
}
long
long
unsigned
int
rt
=
jconf
::
inst
()
->
GetNetRetry
();
printer
::
inst
()
->
print_msg
(
L1
,
"Pool connection lost. Waiting %lld s before retry."
,
rt
);
printer
::
inst
()
->
print_msg
(
L1
,
"Pool connection lost. Waiting %lld s before retry (attempt %llu)."
,
rt
,
int_port
(
iReconnectAttempts
));
auto
work
=
minethd
::
miner_work
();
minethd
::
switch_work
(
work
);
...
...
@@ -178,7 +187,10 @@ void executor::on_sock_ready(size_t pool_id)
}
}
else
{
iReconnectAttempts
=
0
;
reset_stats
();
}
}
void
executor
::
on_sock_error
(
size_t
pool_id
,
std
::
string
&&
sError
)
...
...
This diff is collapsed.
Click to expand it.
executor.h
+
2
−
0
View file @
1b4f0dd5
...
...
@@ -81,6 +81,8 @@ private:
std
::
promise
<
void
>
httpReady
;
std
::
mutex
httpMutex
;
size_t
iReconnectAttempts
=
0
;
struct
sck_error_log
{
std
::
chrono
::
system_clock
::
time_point
time
;
...
...
This diff is collapsed.
Click to expand it.
jconf.cpp
+
12
−
3
View file @
1b4f0dd5
...
...
@@ -38,7 +38,8 @@ using namespace rapidjson;
* This enum needs to match index in oConfigValues, otherwise we will get a runtime error
*/
enum
configEnum
{
iCpuThreadNum
,
aCpuThreadsConf
,
sUseSlowMem
,
bNiceHashMode
,
bTlsMode
,
bTlsSecureAlgo
,
sTlsFingerprint
,
sPoolAddr
,
sWalletAddr
,
sPoolPwd
,
iCallTimeout
,
iNetRetry
,
iVerboseLevel
,
iAutohashTime
,
iHttpdPort
,
bPreferIpv4
};
sPoolAddr
,
sWalletAddr
,
sPoolPwd
,
iCallTimeout
,
iNetRetry
,
iGiveUpLimit
,
iVerboseLevel
,
iAutohashTime
,
iHttpdPort
,
bPreferIpv4
};
struct
configVal
{
configEnum
iName
;
...
...
@@ -60,6 +61,7 @@ configVal oConfigValues[] = {
{
sPoolPwd
,
"pool_password"
,
kStringType
},
{
iCallTimeout
,
"call_timeout"
,
kNumberType
},
{
iNetRetry
,
"retry_time"
,
kNumberType
},
{
iGiveUpLimit
,
"giveup_limit"
,
kNumberType
},
{
iVerboseLevel
,
"verbose_level"
,
kNumberType
},
{
iAutohashTime
,
"h_print_time"
,
kNumberType
},
{
iHttpdPort
,
"httpd_port"
,
kNumberType
},
...
...
@@ -207,6 +209,11 @@ uint64_t jconf::GetNetRetry()
return
prv
->
configValues
[
iNetRetry
]
->
GetUint64
();
}
uint64_t
jconf
::
GetGiveUpLimit
()
{
return
prv
->
configValues
[
iGiveUpLimit
]
->
GetUint64
();
}
uint64_t
jconf
::
GetVerboseLevel
()
{
return
prv
->
configValues
[
iVerboseLevel
]
->
GetUint64
();
...
...
@@ -378,10 +385,12 @@ bool jconf::parse_config(const char* sFilename)
return
false
;
}
if
(
!
prv
->
configValues
[
iCallTimeout
]
->
IsUint64
()
||
!
prv
->
configValues
[
iNetRetry
]
->
IsUint64
())
if
(
!
prv
->
configValues
[
iCallTimeout
]
->
IsUint64
()
||
!
prv
->
configValues
[
iNetRetry
]
->
IsUint64
()
||
!
prv
->
configValues
[
iGiveUpLimit
]
->
IsUint64
())
{
printer
::
inst
()
->
print_msg
(
L0
,
"Invalid config file. call_timeout
and
retry_time need to be positive integers."
);
"Invalid config file. call_timeout
,
retry_time
and giveup_limit
need to be positive integers."
);
return
false
;
}
...
...
This diff is collapsed.
Click to expand it.
jconf.h
+
1
−
0
View file @
1b4f0dd5
...
...
@@ -45,6 +45,7 @@ public:
uint64_t
GetCallTimeout
();
uint64_t
GetNetRetry
();
uint64_t
GetGiveUpLimit
();
uint16_t
GetHttpdPort
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment