Show More
@@ -100,6 +100,19 b' class lock(object):' | |||
|
100 | 100 | raise error.LockUnavailable(why.errno, why.strerror, |
|
101 | 101 | why.filename, self.desc) |
|
102 | 102 | |
|
103 | def _readlock(self): | |
|
104 | """read lock and return its value | |
|
105 | ||
|
106 | Returns None if no lock exists, pid for old-style locks, and host:pid | |
|
107 | for new-style locks. | |
|
108 | """ | |
|
109 | try: | |
|
110 | return self.vfs.readlock(self.f) | |
|
111 | except (OSError, IOError) as why: | |
|
112 | if why.errno == errno.ENOENT: | |
|
113 | return None | |
|
114 | raise | |
|
115 | ||
|
103 | 116 | def testlock(self): |
|
104 | 117 | """return id of locker if lock is valid, else None. |
|
105 | 118 | |
@@ -111,12 +124,9 b' class lock(object):' | |||
|
111 | 124 | The lock file is only deleted when None is returned. |
|
112 | 125 | |
|
113 | 126 | """ |
|
114 | try: | |
|
115 | locker = self.vfs.readlock(self.f) | |
|
116 | except (OSError, IOError) as why: | |
|
117 | if why.errno == errno.ENOENT: | |
|
127 | locker = self._readlock() | |
|
128 | if locker is None: | |
|
118 | 129 |
|
|
119 | raise | |
|
120 | 130 | try: |
|
121 | 131 | host, pid = locker.split(":", 1) |
|
122 | 132 | except ValueError: |
General Comments 0
You need to be logged in to leave comments.
Login now