diff --git a/src/allmydata/interfaces.py b/src/allmydata/interfaces.py
index 14e52be..14ddc85 100644
a
|
b
|
class IServer(IDisplayableServer): |
433 | 433 | def start_connecting(tub, trigger_cb): |
434 | 434 | pass |
435 | 435 | def get_rref(): |
436 | | pass |
| 436 | """Once a server is connected, I return a RemoteReference. |
| 437 | Before a server is connected for the first time, I return None. |
| 438 | |
| 439 | Note that the rref I return will start producing DeadReferenceErrors |
| 440 | once the connection is lost. |
| 441 | """ |
437 | 442 | |
438 | 443 | |
439 | 444 | class IMutableSlotWriter(Interface): |
diff --git a/src/allmydata/storage_client.py b/src/allmydata/storage_client.py
index 68823f0..b536c67 100644
a
|
b
|
class StorageFarmBroker: |
77 | 77 | def test_add_rref(self, serverid, rref, ann): |
78 | 78 | s = NativeStorageServer(serverid, ann.copy()) |
79 | 79 | s.rref = rref |
| 80 | s._is_connected = True |
80 | 81 | self.servers[serverid] = s |
81 | 82 | |
82 | 83 | def test_add_server(self, serverid, s): |
… |
… |
class StorageFarmBroker: |
129 | 130 | return frozenset(self.servers.keys()) |
130 | 131 | |
131 | 132 | def get_connected_servers(self): |
132 | | return frozenset([s for s in self.servers.values() if s.get_rref()]) |
| 133 | return frozenset([s for s in self.servers.values() if s.is_connected()]) |
133 | 134 | |
134 | 135 | def get_known_servers(self): |
135 | 136 | return frozenset(self.servers.values()) |
… |
… |
class NativeStorageServer: |
215 | 216 | self.last_loss_time = None |
216 | 217 | self.remote_host = None |
217 | 218 | self.rref = None |
| 219 | self._is_connected = False |
218 | 220 | self._reconnector = None |
219 | 221 | self._trigger_cb = None |
220 | 222 | |
… |
… |
class NativeStorageServer: |
254 | 256 | return self.announcement |
255 | 257 | def get_remote_host(self): |
256 | 258 | return self.remote_host |
| 259 | def is_connected(self): |
| 260 | return self._is_connected |
257 | 261 | def get_last_connect_time(self): |
258 | 262 | return self.last_connect_time |
259 | 263 | def get_last_loss_time(self): |
… |
… |
class NativeStorageServer: |
287 | 291 | self.last_connect_time = time.time() |
288 | 292 | self.remote_host = rref.getPeer() |
289 | 293 | self.rref = rref |
| 294 | self._is_connected = True |
290 | 295 | rref.notifyOnDisconnect(self._lost) |
291 | 296 | |
292 | 297 | def get_rref(self): |
… |
… |
class NativeStorageServer: |
296 | 301 | log.msg(format="lost connection to %(name)s", name=self.get_name(), |
297 | 302 | facility="tahoe.storage_broker", umid="zbRllw") |
298 | 303 | self.last_loss_time = time.time() |
299 | | self.rref = None |
| 304 | # self.rref is now stale: all callRemote()s will get a |
| 305 | # DeadReferenceError. We leave the stale reference in place so that |
| 306 | # uploader/downloader code (which received this IServer through |
| 307 | # get_connected_servers() or get_servers_for_psi()) can continue to |
| 308 | # use s.get_rref().callRemote() and not worry about it being None. |
| 309 | self._is_connected = False |
300 | 310 | self.remote_host = None |
301 | 311 | |
302 | 312 | def stop_connecting(self): |