diff options
Diffstat (limited to '')
-rw-r--r-- | src/stable/multiserver.cpp | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/stable/multiserver.cpp b/src/stable/multiserver.cpp index e0386a7..697725c 100644 --- a/src/stable/multiserver.cpp +++ b/src/stable/multiserver.cpp | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "bu/multiserver.h" | 8 | #include "bu/multiserver.h" |
9 | #include "bu/protocol.h" | 9 | #include "bu/protocol.h" |
10 | #include "bu/client.h" | 10 | #include "bu/client.h" |
11 | #include "bu/serversocket.h" | ||
11 | 12 | ||
12 | #include "bu/config.h" | 13 | #include "bu/config.h" |
13 | 14 | ||
@@ -21,23 +22,23 @@ Bu::MultiServer::~MultiServer() | |||
21 | { | 22 | { |
22 | } | 23 | } |
23 | 24 | ||
24 | void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort, | 25 | void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), |
25 | int nPoolSize ) | 26 | Bu::ServerSocket *pServer ) |
26 | { | 27 | { |
27 | hProtos[iPort] = proc; | 28 | addServerSocket( pServer ); |
28 | addPort( iPort, nPoolSize ); | 29 | int iFd; |
30 | pServer->getFd( iFd ); | ||
31 | hProtos.insert( iFd, proc ); | ||
29 | } | 32 | } |
30 | 33 | ||
31 | void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const String &sAddr, | 34 | void Bu::MultiServer::onNewConnection( const Bu::ServerSocket *pSrv, |
32 | int iPort, int nPoolSize ) | 35 | Client *pClient, Bu::Socket * /*pSocket*/ ) |
33 | { | 36 | { |
34 | hProtos[iPort] = proc; | 37 | int iFd; |
35 | addPort( sAddr, iPort, nPoolSize ); | 38 | if( pSrv->getFd( iFd ) ) |
36 | } | 39 | { |
37 | 40 | pClient->setProtocol( hProtos.get( iFd )() ); | |
38 | void Bu::MultiServer::onNewConnection( Bu::Client *pClient, int nPort ) | 41 | } |
39 | { | ||
40 | pClient->setProtocol( hProtos.get( nPort )() ); | ||
41 | } | 42 | } |
42 | 43 | ||
43 | void Bu::MultiServer::onClosedConnection( Bu::Client *pClient ) | 44 | void Bu::MultiServer::onClosedConnection( Bu::Client *pClient ) |