summaryrefslogtreecommitdiff
path: root/src/old/tests/srvstress.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/old/tests/srvstress.cpp')
-rw-r--r--src/old/tests/srvstress.cpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/src/old/tests/srvstress.cpp b/src/old/tests/srvstress.cpp
deleted file mode 100644
index d9a9a1c..0000000
--- a/src/old/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}