Subversion Repositories HomeAutomation

Rev

Rev 1592 | Rev 1595 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1592 Rev 1593
Line 58... Line 58...
58
 
58
 
59
void TcpClient::AcceptHandler(const boost::system::error_code& error)
59
void TcpClient::AcceptHandler(const boost::system::error_code& error)
60
{
60
{
61
    this->Read();
61
    this->Read();
62
   
62
   
63
    this->signal_on_new_state_(this->GetId(), CLIENT_STATE_ACCEPTED);
63
    this->signal_on_new_state_(this->GetId(), this->GetServerId(), CLIENT_STATE_ACCEPTED);
64
}
64
}
65
 
65
 
66
TcpClient::AcceptorPointer TcpClient::ReleaseAcceptor()
66
TcpClient::AcceptorPointer TcpClient::ReleaseAcceptor()
67
{
67
{
68
    AcceptorPointer acceptor = this->acceptor_;
68
    AcceptorPointer acceptor = this->acceptor_;
Line 99... Line 99...
99
   
99
   
100
    Client::Disconnect();
100
    Client::Disconnect();
101
}
101
}
102
 
102
 
103
void TcpClient::Send(Buffer data)
103
void TcpClient::Send(Buffer data)
-
 
104
{
-
 
105
    if (this->acceptor_.use_count() != 0)
-
 
106
    {
-
 
107
        return;
-
 
108
    }
-
 
109
   
-
 
110
    if (this->socket_.is_open())
104
{
111
    {
105
    this->socket_.send(boost::asio::buffer(data));
112
        this->socket_.send(boost::asio::buffer(data));
-
 
113
    }
-
 
114
    else
-
 
115
    {
-
 
116
        this->Disconnect();
-
 
117
    }
106
}
118
}
107
 
119
 
108
void TcpClient::Read()
120
void TcpClient::Read()
109
{
121
{
110
    Client::Read();
122
    Client::Read();