mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-03 12:58:05 +01:00
Fixed socket states in tests
This commit is contained in:
parent
4d9b046977
commit
67aa788577
@ -39,6 +39,9 @@ int main ()
|
|||||||
{
|
{
|
||||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||||
assert (expect == returned);
|
assert (expect == returned);
|
||||||
|
// Adjust socket state so that poll shows only 1 pending message.
|
||||||
|
zmq::message_t mx ;
|
||||||
|
p.first->recv(&mx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,9 @@ int main()
|
|||||||
{
|
{
|
||||||
const string returned = zmqtestutil::ping_pong (p, expect);
|
const string returned = zmqtestutil::ping_pong (p, expect);
|
||||||
assert (expect == returned);
|
assert (expect == returned);
|
||||||
|
// Adjust socket state, so that first is clean for another send.
|
||||||
|
zmq::message_t mx ;
|
||||||
|
p.first->recv(&mx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -55,8 +55,12 @@ namespace zmqtestutil
|
|||||||
zmq::message_t pong;
|
zmq::message_t pong;
|
||||||
s2.recv (&pong, 0);
|
s2.recv (&pong, 0);
|
||||||
|
|
||||||
|
// Send message via s2, so state is clean in case of req/rep.
|
||||||
|
std::string ret((char *)pong.data(), pong.size());
|
||||||
|
s2.send(pong, 0);
|
||||||
|
|
||||||
// Return received data as std::string.
|
// Return received data as std::string.
|
||||||
return std::string ((char*) pong.data(), pong.size());
|
return ret ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user