On 2013-03-12 AM 4:35, jojelino wrote:
I was trying to CTRL+C cygwin python process that is executing some
operation and fell asleep for 60 seconds repeatedly. I'm pretty sure
that the process was sleeping as i tried interrupt it.
And some operation includes making connection to localhost tcp server and sending some command to that. so another thread would be mswsock!SockAsyncThread.
this case was very rare and i rarely saw the livelock except this time.
#! /usr/bin/python
from telnetlib import *
import re,sys,time,datetime
t=Telnet()
t.open('127.0.0.1','9051')
def burst(inp):
 for e in inp.split('\n'):
  prep=e
  print prep
  t.write (e+'\n')
  ds=t.expect([re.compile('\n')])
  print ds[2].strip()
#login for tor control protocol
burstcommand=""
burst(burstcommand)
if len(sys.argv)>1:
 f=open(sys.argv[1],'r')
 good=f.readline().split(',')
 others=f.readline().split(',')
 good=filter(lambda x:x not in others,good)
 exclude=f.readline().split(',')
 others=filter(lambda x:x not in exclude,others);
 assert(len(good)>0)
 assert(len(others)>0)
 f.close()
else: raise Exception("list needed")
import random

cont=True
while cont:
 for j in range(10):
  if cont:
   s=list()
   if len(others)>1:
    xx=good[random.randint(0,len(good)-1)]
    s.append(xx)
    s.append(others.pop(random.randint(0,len(others)-1)))
   else:
    print 'others insufficient'
    cont=False
    break
   if cont==True:
    #print "extendcircuit 0", ",".join(s)
    burst("extendcircuit 0 {0}".format(",".join(s)))
  else:
   break
 print "====================================================="
 time.sleep(60)
t.close()
--
Regards.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to