aboutsummaryrefslogtreecommitdiff
path: root/src/tests/srvstress.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
committerMike Buland <eichlan@xagasoft.com>2007-04-03 03:49:53 +0000
commitf4c20290509d7ed3a8fd5304577e7a4cc0b9d974 (patch)
tree13cdf64f7cf134f397a7165b7a3fe0807e37026b /src/tests/srvstress.cpp
parent74d4c8cd27334fc7204d5a8773deb3d424565778 (diff)
downloadlibbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.gz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.bz2
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.tar.xz
libbu++-f4c20290509d7ed3a8fd5304577e7a4cc0b9d974.zip
Ok, no code is left in src, it's all in src/old. We'll gradually move code back
into src as it's fixed and re-org'd. This includes tests, which, I may write a unit test system into libbu++ just to make my life easier.
Diffstat (limited to 'src/tests/srvstress.cpp')
-rw-r--r--src/tests/srvstress.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/tests/srvstress.cpp b/src/tests/srvstress.cpp
deleted file mode 100644
index d9a9a1c..0000000
--- a/src/tests/srvstress.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
1#include "connectionmanager.h"
2#include "programlink.h"
3#include "linkedlist.h"
4#include "protocol.h"
5
6class StressProtocol : public Protocol
7{
8public:
9 bool onNewData()
10 {
11 switch( getConnection()->getInput()[0] )
12 {
13 case 'd':
14 throw "Hello";
15 break;
16
17 case 'w':
18 getConnection()->appendOutput("Hello");
19 break;
20 };
21
22 return true;
23 }
24
25 bool onNewConnection()
26 {
27 return true;
28 }
29};
30
31class StressMonitor : public ConnectionMonitor, public ProgramLink
32{
33public:
34 bool init()
35 {
36 return true;
37 }
38
39 bool deInit()
40 {
41 return true;
42 }
43
44 bool timeSlice()
45 {
46 return true;
47 }
48
49 bool onNewConnection( Connection *pCon, int nPort )
50 {
51 StressProtocol *sp = new StressProtocol();
52 pCon->setProtocol( sp );
53
54 printf(" sys: New connection: socket(%d), port(%d)\n",
55 pCon->getSocket(), nPort );
56
57 return true;
58 }
59
60 bool onClosedConnection( Connection *pCon )
61 {
62 printf(" sys: Closed connection: socket(%d)\n",
63 pCon->getSocket() );
64
65 return true;
66 }
67
68 LinkMessage *processIRM( LinkMessage *pMsg )
69 {
70 return NULL;
71 }
72};
73
74int main()
75{
76 printf("Starting server...\n");
77
78 ConnectionManager srv;
79 StressMonitor telnet;
80
81 srv.setConnectionMonitor( &telnet );
82
83 srv.startServer( 4001 );
84
85 for(;;)
86 {
87 srv.scanConnections( 5000, false );
88 }
89
90 return 0;
91}