diff options
author | Mike Buland <eichlan@xagasoft.com> | 2008-02-07 19:01:12 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2008-02-07 19:01:12 +0000 |
commit | 9ab87f39d7fc37e52d742d38b191eed9128d4b5b (patch) | |
tree | 17a00529eda3d9a5a979c05d688f219f7af1631a /src/client.h | |
parent | 5574841cc88412854b2cb94253152b3606803e2a (diff) | |
download | libbu++-9ab87f39d7fc37e52d742d38b191eed9128d4b5b.tar.gz libbu++-9ab87f39d7fc37e52d742d38b191eed9128d4b5b.tar.bz2 libbu++-9ab87f39d7fc37e52d742d38b191eed9128d4b5b.tar.xz libbu++-9ab87f39d7fc37e52d742d38b191eed9128d4b5b.zip |
Wowee, I think all this new stuff works, Conduit I don't need now, so it's not
done yet. The Client class now supports a function called getLink() which
returns a ClientLink object. This object may then be passed off to any other
class and called to send messages to that client object. It is threadsafe if
ItoServer is being used, and not for Server. Sending a message via a
ClientLink calls the onMessage function on the assosiated protocol.
Note that sending messages from within protocol event handlers or functions they
call, while safe, may be slow and it's reccomended that you avoid this.
Diffstat (limited to '')
-rw-r--r-- | src/client.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/client.h b/src/client.h index 3764375..20eb8b8 100644 --- a/src/client.h +++ b/src/client.h | |||
@@ -16,6 +16,7 @@ namespace Bu | |||
16 | { | 16 | { |
17 | class Protocol; | 17 | class Protocol; |
18 | class Socket; | 18 | class Socket; |
19 | class ClientLinkFactory; | ||
19 | 20 | ||
20 | /** | 21 | /** |
21 | *@author Mike Buland | 22 | *@author Mike Buland |
@@ -24,7 +25,7 @@ namespace Bu | |||
24 | class Client | 25 | class Client |
25 | { | 26 | { |
26 | public: | 27 | public: |
27 | Client( Bu::Socket *pSocket ); | 28 | Client( Bu::Socket *pSocket, Bu::ClientLinkFactory *pfLink ); |
28 | virtual ~Client(); | 29 | virtual ~Client(); |
29 | 30 | ||
30 | void processInput(); | 31 | void processInput(); |
@@ -59,6 +60,10 @@ namespace Bu | |||
59 | void disconnect(); | 60 | void disconnect(); |
60 | bool wantsDisconnect(); | 61 | bool wantsDisconnect(); |
61 | 62 | ||
63 | class ClientLink *getLink(); | ||
64 | |||
65 | void onMessage( const Bu::FString &sMsg ); | ||
66 | |||
62 | private: | 67 | private: |
63 | Bu::Socket *pSocket; | 68 | Bu::Socket *pSocket; |
64 | Bu::Protocol *pProto; | 69 | Bu::Protocol *pProto; |
@@ -66,6 +71,7 @@ namespace Bu | |||
66 | int nRBOffset; | 71 | int nRBOffset; |
67 | Bu::FString sWriteBuf; | 72 | Bu::FString sWriteBuf; |
68 | bool bWantsDisconnect; | 73 | bool bWantsDisconnect; |
74 | class Bu::ClientLinkFactory *pfLink; | ||
69 | }; | 75 | }; |
70 | } | 76 | } |
71 | 77 | ||