Changeset a618ea6 for skype/skyped.py


Ignore:
Timestamp:
2010-12-13T03:37:30Z (13 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
988d75c, eeab8bc
Parents:
451f121
Message:

new testcase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.py

    r451f121 ra618ea6  
    3838
    3939def eh(type, value, tb):
     40        global options
     41
    4042        if type != KeyboardInterrupt:
    4143                print_exception(type, value, tb)
    4244        gobject.MainLoop().quit()
     45        options.conn.close()
    4346        # shut down client if it's running
    4447        try:
     
    7578        return True
    7679
     80def send(sock, txt):
     81        from time import sleep
     82        count = 1
     83        done = False
     84        while (not done) and (count < 10):
     85                try:
     86                        sock.send(txt)
     87                        done = True
     88                except Exception, s:
     89                        count += 1
     90                        dprint("Warning, sending '%s' failed (%s). count=%d" % (txt, s, count))
     91                        sleep(1)
     92        if not done:
     93                options.conn.close()
     94
    7795def bitlbee_idle_handler(skype):
    7896        if options.conn:
    7997                try:
    8098                        e = "PING"
    81                         options.conn.send("%s\n" % e)
     99                        send(options.conn, "%s\n" % e)
    82100                except Exception, s:
    83101                        dprint("Warning, sending '%s' failed (%s)." % (e, s))
     
    137155        if options.debug:
    138156                print now + ": " + msg
     157                sys.stdout.flush()
    139158        if options.log:
    140159                sock = open(options.log, "a")
     
    172191                        if options.conn:
    173192                                try:
    174                                         options.conn.send(e + "\n")
     193                                        send(options.conn, e + "\n")
    175194                                except Exception, s:
    176195                                        dprint("Warning, sending '%s' failed (%s)." % (e, s))
Note: See TracChangeset for help on using the changeset viewer.