~raghavendra-prabhu/percona-xtradb-cluster/release-5.5.30-galera-2.x

« back to all changes in this revision

Viewing changes to gcomm/src/asio_tcp.cpp

  • Committer: Raghavendra D Prabhu
  • Date: 2013-04-05 13:55:24 UTC
  • mfrom: (95.2.22 2.x)
  • Revision ID: raghavendra.prabhu@percona.com-20130405135524-aa4f4y9rko7t3cvt
Merge galera/2.x branch.

We merge upto r148 of galera/2.x branch for 5.5.30-23.7.4 PXC release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
133
133
{
134
134
    Critical<AsioProtonet> crit(net_);
135
135
 
136
 
    log_debug << "connect handler " << id() << " " << ec;
137
 
 
138
 
    if (ec)
139
 
    {
140
 
        FAILED_HANDLER(ec);
141
 
        return;
142
 
    }
143
 
    else
144
 
    {
145
 
        assign_local_addr();
146
 
        assign_remote_addr();
 
136
    try
 
137
    {
 
138
        if (ec)
 
139
        {
 
140
            FAILED_HANDLER(ec);
 
141
            return;
 
142
        }
 
143
        else
 
144
        {
 
145
            assign_local_addr();
 
146
            assign_remote_addr();
147
147
#ifdef HAVE_ASIO_SSL_HPP
148
 
        if (ssl_socket_ != 0)
149
 
        {
150
 
            ssl_socket_->lowest_layer().set_option(
151
 
                asio::ip::tcp::no_delay(true));
152
 
            set_fd_options(ssl_socket_->lowest_layer());
153
 
            log_debug << "socket " << id() << " connected, remote endpoint "
154
 
                      << remote_addr() << " local endpoint "
155
 
                      << local_addr();
156
 
            try
 
148
            if (ssl_socket_ != 0)
157
149
            {
 
150
                ssl_socket_->lowest_layer().set_option(
 
151
                    asio::ip::tcp::no_delay(true));
 
152
                set_fd_options(ssl_socket_->lowest_layer());
 
153
                log_debug << "socket " << id() << " connected, remote endpoint "
 
154
                          << remote_addr() << " local endpoint "
 
155
                          << local_addr();
158
156
                ssl_socket_->async_handshake(
159
157
                    asio::ssl::stream<asio::ip::tcp::socket>::client,
160
158
                    boost::bind(&AsioTcpSocket::handshake_handler,
161
159
                                shared_from_this(),
162
160
                                asio::placeholders::error)
163
 
                );
 
161
                    );
164
162
            }
165
 
            catch (asio::system_error& e)
 
163
            else
166
164
            {
167
 
                FAILED_HANDLER(e.code());
168
 
                return;
169
 
            }
170
 
        }
171
 
        else
172
 
        {
173
165
#endif /* HAVE_ASIO_SSL_HPP */
174
 
            socket_.set_option(asio::ip::tcp::no_delay(true));
175
 
            set_fd_options(socket_);
176
 
            log_debug << "socket " << id() << " connected, remote endpoint "
177
 
                      << remote_addr() << " local endpoint "
178
 
                      << local_addr();
179
 
            state_ = S_CONNECTED;
180
 
            net_.dispatch(id(), Datagram(), ProtoUpMeta(ec.value()));
181
 
            async_receive();
 
166
                socket_.set_option(asio::ip::tcp::no_delay(true));
 
167
                set_fd_options(socket_);
 
168
                log_debug << "socket " << id() << " connected, remote endpoint "
 
169
                          << remote_addr() << " local endpoint "
 
170
                          << local_addr();
 
171
                state_ = S_CONNECTED;
 
172
                net_.dispatch(id(), Datagram(), ProtoUpMeta(ec.value()));
 
173
                async_receive();
182
174
 
183
175
#ifdef HAVE_ASIO_SSL_HPP
 
176
            }
 
177
#endif /* HAVE_ASIO_SSL_HPP */
184
178
        }
185
 
#endif /* HAVE_ASIO_SSL_HPP */
 
179
    }
 
180
    catch (asio::system_error& e)
 
181
    {
 
182
        FAILED_HANDLER(e.code());
186
183
    }
187
184
}
188
185
 
232
229
            << uri.to_string()
233
230
            << "', asio error '" << e.what() << "'";
234
231
    }
235
 
 
236
232
}
237
233
 
238
234
void gcomm::AsioTcpSocket::close()