Rev 1939 | Rev 1962 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1939 | Rev 1959 | ||
|---|---|---|---|
| Line 26... | Line 26... | ||
| 26 | #include <boost/lexical_cast.hpp> |
26 | #include <boost/lexical_cast.hpp> |
| 27 | 27 | ||
| 28 | namespace atom { |
28 | namespace atom { |
| 29 | namespace net { |
29 | namespace net { |
| 30 | 30 | ||
| 31 | Client::Client(boost::asio::io_service& io_service, |
31 | Client::Client(boost::asio::io_service& io_service, SocketId id, SocketId server_id) : buffer_(2048) |
| 32 | { |
32 | { |
| 33 | this->server_id_ = server_id; |
33 | this->server_id_ = server_id; |
| 34 | this->id_ = id; |
34 | this->id_ = id; |
| 35 | } |
35 | } |
| 36 | 36 | ||
| Line 43... | Line 43... | ||
| 43 | { |
43 | { |
| 44 | this->signal_on_new_state_.connect(slot_on_new_state); |
44 | this->signal_on_new_state_.connect(slot_on_new_state); |
| 45 | this->signal_on_new_data_.connect(slot_on_new_data); |
45 | this->signal_on_new_data_.connect(slot_on_new_data); |
| 46 | } |
46 | } |
| 47 | 47 | ||
| 48 |
|
48 | SocketId Client::GetId() |
| 49 | { |
49 | { |
| 50 | return this->id_; |
50 | return this->id_; |
| 51 | } |
51 | } |
| 52 | 52 | ||
| 53 |
|
53 | SocketId Client::GetServerId() |
| 54 | { |
54 | { |
| 55 | return this->server_id_; |
55 | return this->server_id_; |
| 56 | } |
56 | } |
| 57 | 57 | ||
| 58 | void Client::Read() |
58 | void Client::Read() |
| Line 86... | Line 86... | ||
| 86 | 86 | ||
| 87 | void Client::Disconnect() |
87 | void Client::Disconnect() |
| 88 | { |
88 | { |
| 89 | if (this->id_ != 0) |
89 | if (this->id_ != 0) |
| 90 | { |
90 | { |
| 91 |
|
91 | SocketId id = this->id_; |
| 92 | 92 | ||
| 93 | this->Stop(); |
93 | this->Stop(); |
| 94 | 94 | ||
| 95 | this->id_ = 0; |
95 | this->id_ = 0; |
| 96 | 96 | ||