First version of the shared memory transport.

Use via `--transport shmem` cmd option. No pub/sub.
This commit is contained in:
Alexey Rybalchenko
2016-06-03 11:24:12 +02:00
parent 6c3b01f09c
commit a332d9fc83
39 changed files with 2121 additions and 309 deletions

View File

@@ -108,24 +108,7 @@ void FairMQSocketZMQ::Connect(const string& address)
int FairMQSocketZMQ::Send(FairMQMessage* msg, const string& flag)
{
int nbytes = zmq_msg_send(static_cast<zmq_msg_t*>(msg->GetMessage()), fSocket, GetConstant(flag));
if (nbytes >= 0)
{
fBytesTx += nbytes;
++fMessagesTx;
return nbytes;
}
if (zmq_errno() == EAGAIN)
{
return -2;
}
if (zmq_errno() == ETERM)
{
LOG(INFO) << "terminating socket " << fId;
return -1;
}
LOG(ERROR) << "Failed sending on socket " << fId << ", reason: " << zmq_strerror(errno);
return nbytes;
return Send(msg, GetConstant(flag));
}
int FairMQSocketZMQ::Send(FairMQMessage* msg, const int flags)
@@ -218,24 +201,7 @@ int64_t FairMQSocketZMQ::Send(const vector<unique_ptr<FairMQMessage>>& msgVec, c
int FairMQSocketZMQ::Receive(FairMQMessage* msg, const string& flag)
{
int nbytes = zmq_msg_recv(static_cast<zmq_msg_t*>(msg->GetMessage()), fSocket, GetConstant(flag));
if (nbytes >= 0)
{
fBytesRx += nbytes;
++fMessagesRx;
return nbytes;
}
if (zmq_errno() == EAGAIN)
{
return -2;
}
if (zmq_errno() == ETERM)
{
LOG(INFO) << "terminating socket " << fId;
return -1;
}
LOG(ERROR) << "Failed receiving on socket " << fId << ", reason: " << zmq_strerror(errno);
return nbytes;
return Receive(msg, GetConstant(flag));
}
int FairMQSocketZMQ::Receive(FairMQMessage* msg, const int flags)
@@ -323,6 +289,14 @@ void FairMQSocketZMQ::Terminate()
}
}
void FairMQSocketZMQ::Interrupt()
{
}
void FairMQSocketZMQ::Resume()
{
}
void* FairMQSocketZMQ::GetSocket() const
{
return fSocket;