Changeset 6b9cab1 for skype/skyped.py


Ignore:
Timestamp:
2008-11-16T01:16:54Z (16 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
56ae398
Parents:
c1bf7c5
Message:

skyped: handle the case when even reading the user/pass fails

ideally this is rare, i never got a network error right after connect,
but you can never be sure.. ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.py

    rc1bf7c5 r6b9cab1  
    118118                        return False
    119119        ret = 0
    120         line = options.conn.recv(1024)
    121         if line.startswith("USERNAME") and line.split(' ')[1].strip() == options.config.username:
    122                 ret += 1
    123         line = options.conn.recv(1024)
    124         if line.startswith("PASSWORD") and sha.sha(line.split(' ')[1].strip()).hexdigest() == options.config.password:
    125                 ret += 1
     120        try:
     121                line = options.conn.recv(1024)
     122                if line.startswith("USERNAME") and line.split(' ')[1].strip() == options.config.username:
     123                        ret += 1
     124                line = options.conn.recv(1024)
     125                if line.startswith("PASSWORD") and sha.sha(line.split(' ')[1].strip()).hexdigest() == options.config.password:
     126                        ret += 1
     127        except Exception, s:
     128                dprint("Warning, receiving 1024 bytes failed (%s)." % s)
     129                options.conn.close()
     130                return False
    126131        if ret == 2:
    127132                dprint("Username and password OK.")
Note: See TracChangeset for help on using the changeset viewer.