68 std::cerr <<
"Lost connection to client\n";
90 unsigned code = msg.first;
92 std::string reply =
"S" + std::to_string(
fNWorker);
106 reply +=
": unknown code received. code=" + std::to_string(code);
virtual void HandleInput(MPCodeBufPair &msg)
Handle a message with an EMPCode.
pid_t fPid
the PID of the process in which this worker is running
unsigned fNWorker
the ordinal number of this worker (0 to nWorkers-1)
int MPSend(TSocket *s, unsigned code)
Send a message with the specified code on the specified socket.
Error while reading from the socket.
Used by the workers to notify client of shutdown.
std::unique_ptr< TSocket > fS
This worker's socket. The unique_ptr makes sure resources are released.
Fatal error: whoever sends this message is terminating execution.
R__EXTERN TSystem * gSystem
TMPWorker()
Class constructor.
std::pair< unsigned, std::unique_ptr< TBufferFile >> MPCodeBufPair
An std::pair that wraps the code and optional object contained in a message.
Used by the client to tell servers to shutdown.
virtual void Exit(int code, Bool_t mode=kTRUE)
Exit the application.
virtual void Init(int fd, unsigned workerN)
This method is called by children processes right after forking.
MPCodeBufPair MPRecv(TSocket *s)
Receive message from a socket.