summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-08-15 22:48:07 +0000
committerChris Wilson <chris+github@qwirx.com>2014-08-15 22:48:07 +0000
commit015a32555fc2c2435a83123add5f26614e6e41a6 (patch)
tree2891cab0d1a4e04a6059b49644cf3196690d3f82 /test
parent05a0404eaaf9fc333d719f6d11de384a3cc133e9 (diff)
Add missing network operation timeouts to test/basicserver.
Diffstat (limited to 'test')
-rw-r--r--test/basicserver/testbasicserver.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/test/basicserver/testbasicserver.cpp b/test/basicserver/testbasicserver.cpp
index fe06e8c2..e6b0fa54 100644
--- a/test/basicserver/testbasicserver.cpp
+++ b/test/basicserver/testbasicserver.cpp
@@ -36,6 +36,7 @@
// in ms
#define COMMS_READ_TIMEOUT 4
#define COMMS_SERVER_WAIT_BEFORE_REPLYING 40
+#define SHORT_TIMEOUT 5000
class basicdaemon : public Daemon
{
@@ -112,7 +113,7 @@ void testservers_connection(SocketStream &rStream)
}
for(int s = 0; s < (LARGE_DATA_SIZE / LARGE_DATA_BLOCK_SIZE); ++s)
{
- rStream.Write(data, sizeof(data));
+ rStream.Write(data, sizeof(data), SHORT_TIMEOUT);
}
}
{
@@ -120,7 +121,8 @@ void testservers_connection(SocketStream &rStream)
char buf[1024];
int total = 0;
int r = 0;
- while(total < LARGE_DATA_SIZE && (r = rStream.Read(buf, sizeof(buf))) != 0)
+ while(total < LARGE_DATA_SIZE &&
+ (r = rStream.Read(buf, sizeof(buf), SHORT_TIMEOUT)) != 0)
{
total += r;
}
@@ -142,7 +144,7 @@ void testservers_connection(SocketStream &rStream)
}
for(int s = 0; s < (LARGE_DATA_SIZE / LARGE_DATA_BLOCK_SIZE); ++s)
{
- rStream.Write(data, sizeof(data));
+ rStream.Write(data, sizeof(data), SHORT_TIMEOUT);
}
}
@@ -336,7 +338,7 @@ void Srv2TestConversations(const std::vector<IOStream *> &conns)
}
for(unsigned int c = 0; c < conns.size(); ++c)
{
- conns[c]->Write("LARGEDATA\n", 10);
+ conns[c]->Write("LARGEDATA\n", 10, SHORT_TIMEOUT);
}
for(unsigned int c = 0; c < conns.size(); ++c)
{
@@ -344,7 +346,8 @@ void Srv2TestConversations(const std::vector<IOStream *> &conns)
char buf[1024];
int total = 0;
int r = 0;
- while(total < LARGE_DATA_SIZE && (r = conns[c]->Read(buf, sizeof(buf))) != 0)
+ while(total < LARGE_DATA_SIZE &&
+ (r = conns[c]->Read(buf, sizeof(buf), SHORT_TIMEOUT)) != 0)
{
total += r;
}
@@ -360,7 +363,7 @@ void Srv2TestConversations(const std::vector<IOStream *> &conns)
}
for(int s = 0; s < (LARGE_DATA_SIZE / LARGE_DATA_BLOCK_SIZE); ++s)
{
- conns[c]->Write(data, sizeof(data));
+ conns[c]->Write(data, sizeof(data), SHORT_TIMEOUT);
}
}
for(unsigned int c = 0; c < conns.size(); ++c)
@@ -369,7 +372,8 @@ void Srv2TestConversations(const std::vector<IOStream *> &conns)
char buf[1024];
int total = 0;
int r = 0;
- while(total < LARGE_DATA_SIZE && (r = conns[c]->Read(buf, sizeof(buf))) != 0)
+ while(total < LARGE_DATA_SIZE &&
+ (r = conns[c]->Read(buf, sizeof(buf), SHORT_TIMEOUT)) != 0)
{
total += r;
}
@@ -412,7 +416,8 @@ void TestStreamReceive(TestProtocolClient &protocol, int value, bool uncertainst
while(stream->StreamDataLeft())
{
// Read some data
- int bytes = stream->Read(((char*)values) + bytesleft, sizeof(values) - bytesleft);
+ int bytes = stream->Read(((char*)values) + bytesleft,
+ sizeof(values) - bytesleft, SHORT_TIMEOUT);
bytessofar += bytes;
bytes += bytesleft;
int n = bytes / 4;