diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/client.cpp b/src/client.cpp index 1ef9151..d1eb29c 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
@@ -11,15 +11,18 @@ | |||
11 | #include <errno.h> | 11 | #include <errno.h> |
12 | #include "bu/exceptions.h" | 12 | #include "bu/exceptions.h" |
13 | #include "bu/protocol.h" | 13 | #include "bu/protocol.h" |
14 | #include "bu/clientlink.h" | ||
15 | #include "bu/clientlinkfactory.h" | ||
14 | 16 | ||
15 | /** Read buffer size. */ | 17 | /** Read buffer size. */ |
16 | #define RBS (1024*2) | 18 | #define RBS (1024*2) |
17 | 19 | ||
18 | Bu::Client::Client( Bu::Socket *pSocket ) : | 20 | Bu::Client::Client( Bu::Socket *pSocket, class Bu::ClientLinkFactory *pfLink ) : |
19 | pSocket( pSocket ), | 21 | pSocket( pSocket ), |
20 | pProto( NULL ), | 22 | pProto( NULL ), |
21 | nRBOffset( 0 ), | 23 | nRBOffset( 0 ), |
22 | bWantsDisconnect( false ) | 24 | bWantsDisconnect( false ), |
25 | pfLink( pfLink ) | ||
23 | { | 26 | { |
24 | } | 27 | } |
25 | 28 | ||
@@ -233,3 +236,15 @@ void Bu::Client::close() | |||
233 | { | 236 | { |
234 | pSocket->close(); | 237 | pSocket->close(); |
235 | } | 238 | } |
239 | |||
240 | Bu::ClientLink *Bu::Client::getLink() | ||
241 | { | ||
242 | return pfLink->createLink( this ); | ||
243 | } | ||
244 | |||
245 | void Bu::Client::onMessage( const Bu::FString &sMsg ) | ||
246 | { | ||
247 | if( pProto ) | ||
248 | pProto->onMessage( this, sMsg ); | ||
249 | } | ||
250 | |||