| 2272 | |
| 2273 | |
| 2274 | void SocketManager::exited(const Address& address) |
| 2275 | { |
| 2276 | // TODO(benh): It would be cleaner if this routine could call back |
| 2277 | // into ProcessManager ... then we wouldn't have to convince |
| 2278 | // ourselves that the accesses to each Process object will always be |
| 2279 | // valid. |
| 2280 | synchronized (mutex) { |
| 2281 | if (!links.remotes.contains(address)) { |
| 2282 | return; // No linkees for this socket address! |
| 2283 | } |
| 2284 | |
| 2285 | foreach (const UPID& linkee, links.remotes[address]) { |
| 2286 | // Find and notify the linkers. |
| 2287 | CHECK(links.linkers.contains(linkee)); |
| 2288 | |
| 2289 | foreach (ProcessBase* linker, links.linkers[linkee]) { |
| 2290 | process_manager->deliver(linker, new ExitedEvent(linkee)); |
| 2291 | |
| 2292 | // Remove the linkee pid from the linker. |
| 2293 | CHECK(links.linkees.contains(linker)); |
| 2294 | |
| 2295 | links.linkees[linker].erase(linkee); |
| 2296 | if (links.linkees[linker].empty()) { |
| 2297 | links.linkees.erase(linker); |
| 2298 | } |
| 2299 | } |
| 2300 | |
| 2301 | links.linkers.erase(linkee); |
| 2302 | } |
| 2303 | |
| 2304 | links.remotes.erase(address); |
| 2305 | } |
| 2306 | } |
| 2307 | |
| 2308 | |
| 2309 | void SocketManager::exited(ProcessBase* process) |