aboutsummaryrefslogtreecommitdiff
path: root/src/tests/srvstress.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
committerMike Buland <eichlan@xagasoft.com>2007-07-03 00:28:59 +0000
commitac517a2b7625e0aa0862679e961c6349f859ea3b (patch)
treee3e27a6b9bd5e2be6150088495c91fc91786ad9d /src/tests/srvstress.cpp
parentf8d4301e9fa4f3709258505941e37fab2eadadc6 (diff)
parentbd865cee5f89116c1f054cd0e5c275e97c2d0a9b (diff)
downloadlibbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.gz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.bz2
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.tar.xz
libbu++-ac517a2b7625e0aa0862679e961c6349f859ea3b.zip
The reorg is being put in trunk, I think it's ready. Now we just get to find
out how many applications won't work anymore :)
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}