File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -138,6 +138,25 @@ def run_test():
138
138
reactor .callLater (1 , run_test )
139
139
return result
140
140
141
+ def print_deprecation_warning ():
142
+ '''Once new version is detected, this method prints deprecation warning every 30 seconds.'''
143
+
144
+ log .warning ("New proxy version available! Please update!" )
145
+ reactor .callLater (30 , print_deprecation_warning )
146
+
147
+ def test_update ():
148
+ '''Perform lookup for newer proxy version, on startup and then once a day.
149
+ When new version is found, it starts printing warning message and turned off next checks.'''
150
+
151
+ GIT_URL = 'https://raw.github.com/slush0/stratum-mining-proxy/master/'
152
+ VERSION_FILE = 'mining_libs/version.py'
153
+
154
+ import urllib2
155
+ log .warning ("Checking for updates..." )
156
+ if open (VERSION_FILE ).read () != urllib2 .urlopen (GIT_URL + VERSION_FILE ).read ():
157
+ print_deprecation_warning ()
158
+ return # New version already detected, stop periodic checks
159
+ reactor .callLater (3600 * 24 , test_update )
141
160
142
161
@defer .inlineCallbacks
143
162
def main (args ):
@@ -162,6 +181,8 @@ def main(args):
162
181
args .port = new_host [1 ]
163
182
164
183
log .warning ("Stratum proxy version: %s" % version .VERSION )
184
+ # Setup periodic checks for a new version
185
+ test_update ()
165
186
166
187
if args .tor :
167
188
log .warning ("Configuring Tor connection" )
You can’t perform that action at this time.
0 commit comments