| 784 | } |
| 785 | |
| 786 | void |
| 787 | DmtcpCoordinator::onDisconnect(CoordClient *client) |
| 788 | { |
| 789 | if (client->isNSWorker()) { |
| 790 | client->sock().close(); |
| 791 | delete client; |
| 792 | return; |
| 793 | } |
| 794 | for (size_t i = 0; i < clients.size(); i++) { |
| 795 | if (clients[i] == client) { |
| 796 | clients.erase(clients.begin() + i); |
| 797 | break; |
| 798 | } |
| 799 | } |
| 800 | client->sock().close(); |
| 801 | JNOTE("client disconnected") (client->identity()) (client->progname()); |
| 802 | _virtualPidToClientMap.erase(client->virtualPid()); |
| 803 | |
| 804 | ComputationStatus s = getStatus(); |
| 805 | if (s.numPeers < 1) { |
| 806 | if (flags.exitOnLast) { |
| 807 | JNOTE("last client exited, shutting down.."); |
| 808 | handleUserCommand("q"); |
| 809 | } else { |
| 810 | removeStaleSharedAreaFile(); |
| 811 | } |
| 812 | |
| 813 | // If a kill in is progress, the coordinator refuses any new connections, |
| 814 | // thus we need to reset it to false once all the processes in the |
| 815 | // computations have disconnected. |
| 816 | killInProgress = false; |
| 817 | } else { |
| 818 | // If the coordinator waits at currentBarrier, try to release it. |
| 819 | if (!currentBarrier.empty()) { |
| 820 | // If already registered as a worker at current barrier, |
| 821 | // decrement the worker counter before try to release the barrier. |
| 822 | if (client->barrier() == currentBarrier) { |
| 823 | --workersAtCurrentBarrier; |
| 824 | } |
| 825 | releaseBarrier(currentBarrier); |
| 826 | } |
| 827 | } |
| 828 | |
| 829 | CoordPluginMgr::clientDisconnected(client, s); |
| 830 | |
| 831 | delete client; |
| 832 | } |
| 833 | |
| 834 | void |
| 835 | DmtcpCoordinator::initializeComputation() |
nothing calls this directly
no test coverage detected