File tree 1 file changed +11
-7
lines changed
1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -122,10 +122,6 @@ def broadcast(small_dir, data):
122
122
def gotProtocol (p ):
123
123
p .sendLine (data )
124
124
125
- def timeout (exp ):
126
- print "Timeout?" , exp
127
- raise exp
128
-
129
125
for (kid , ip , port ) in small_dir :
130
126
_stats [ip ] += 1
131
127
point = TCP4ClientEndpoint (reactor , ip , int (port ), timeout = 10 )
@@ -307,13 +303,20 @@ def main():
307
303
cores += [ c ]
308
304
309
305
def play_another_song (var ):
310
- # if var:
311
- # print "ERROR", var
306
+ if var is not None and ( not isinstance ( var , float ) or not isinstance ( var , float )) :
307
+ print "ERROR" , var
312
308
313
309
if cores != []:
314
310
c = cores .pop ()
315
311
d = play (c , directory )
316
- d .addBoth (play_another_song )
312
+ d .addCallback (play_another_song )
313
+
314
+ def replay ():
315
+ cores += [ c ]
316
+
317
+ d .addErrback (replay )
318
+ d .addErrback (play_another_song )
319
+
317
320
else :
318
321
threads .pop ()
319
322
if threads == []:
@@ -325,6 +328,7 @@ def play_another_song(var):
325
328
t0 = default_timer ()
326
329
reactor .run ()
327
330
t1 = default_timer ()
331
+
328
332
print "Overall time: %s" % (t1 - t0 )
329
333
for (ip , v ) in sorted (_stats .iteritems ()):
330
334
print "Stats: %s %s" % (ip , v )
You can’t perform that action at this time.
0 commit comments