MCPcopy Create free account
hub / github.com/dmtcp/dmtcp / onDisconnect

Method onDisconnect

src/dmtcp_coordinator.cpp:786–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

784}
785
786void
787DmtcpCoordinator::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
834void
835DmtcpCoordinator::initializeComputation()

Callers

nothing calls this directly

Calls 11

getStatusFunction · 0.85
isNSWorkerMethod · 0.80
closeMethod · 0.80
eraseMethod · 0.80
beginMethod · 0.80
identityMethod · 0.80
prognameMethod · 0.80
virtualPidMethod · 0.80
barrierMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected