session.cc 17.9 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
// Copyright (C) 2009  Internet Systems Consortium, Inc. ("ISC")
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.

15
#include <config.h>
JINMEI Tatuya's avatar
JINMEI Tatuya committed
16
#include <cc/session_config.h>
17
#include <cc/logger.h>
18

19
#include <stdint.h>
20

21 22 23 24 25 26
// XXX: there seems to be a strange dependency between ASIO and std library
// definitions.  On some platforms if we include std headers before ASIO
// headers unexpected behaviors will happen.
// A middle term solution is to generalize our local wrapper interface
// (currently only available for the auth server), where all such portability
// issues are hidden, and to have other modules use the wrapper.
27
#include <unistd.h>             // for some IPC/network system calls
28 29
#include <asio.hpp>
#include <asio/error_code.hpp>
30
#include <asio/deadline_timer.hpp>
31 32
#include <asio/system_error.hpp>

33 34 35
#include <cc/data.h>
#include <cc/session.h>

36
#include <cstdio>
37
#include <vector>
38 39 40
#include <iostream>
#include <sstream>

JINMEI Tatuya's avatar
JINMEI Tatuya committed
41 42
#include <sys/un.h>

43
#include <boost/bind.hpp>
44
#include <boost/optional.hpp>
45
#include <boost/function.hpp>
46
#include <boost/date_time/posix_time/posix_time_types.hpp>
47

48 49
#include <exceptions/exceptions.h>

50
using namespace std;
Jelte Jansen's avatar
Jelte Jansen committed
51 52
using namespace isc::cc;
using namespace isc::data;
53

54
// some of the asio names conflict with socket API system calls
Jelte Jansen's avatar
 
Jelte Jansen committed
55
// (e.g. write(2)) so we don't import the entire asio namespace.
56
using asio::io_service;
57

Jelte Jansen's avatar
Jelte Jansen committed
58
namespace {
59 60 61 62 63
/// \brief Sets the given Optional 'result' to the given error code
/// Used as a callback for emulating sync reads with async calls
/// \param result Pointer to the optional to set
/// \param err The error code to set it to
void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
64 65 66
setResult(boost::optional<asio::error_code>* result,
          const asio::error_code& err)
{
67 68
    result->reset(err);
}
Jelte Jansen's avatar
Jelte Jansen committed
69 70
}

71 72
namespace isc {
namespace cc {
73

74 75
class SessionImpl {
public:
JINMEI Tatuya's avatar
JINMEI Tatuya committed
76 77
    SessionImpl(io_service& io_service) :
        sequence_(-1), queue_(Element::createList()),
78
        io_service_(io_service), socket_(io_service_), data_length_(0),
Jelte Jansen's avatar
Jelte Jansen committed
79
        timeout_(MSGQ_DEFAULT_TIMEOUT)
JINMEI Tatuya's avatar
JINMEI Tatuya committed
80 81 82 83 84
    {}
    void establish(const char& socket_file);
    void disconnect();
    void writeData(const void* data, size_t datalen);
    size_t readDataLength();
85 86
    // Blocking read. Will throw a SessionTimeout if the timeout value
    // (in seconds) is thrown. If timeout is 0 it will block forever
JINMEI Tatuya's avatar
JINMEI Tatuya committed
87 88
    void readData(void* data, size_t datalen);
    void startRead(boost::function<void()> user_handler);
89 90
    void setTimeout(size_t seconds) { timeout_ = seconds; };
    size_t getTimeout() const { return timeout_; };
91
    int getSocketDesc();
JINMEI Tatuya's avatar
JINMEI Tatuya committed
92

Jelte Jansen's avatar
Jelte Jansen committed
93
    long int sequence_; // the next sequence number to use
94
    std::string lname_;
Jelte Jansen's avatar
Jelte Jansen committed
95
    ElementPtr queue_;
96

97
private:
98
    void internalRead(const asio::error_code& error,
99 100 101 102
                      size_t bytes_transferred);

private:
    io_service& io_service_;
Jelte Jansen's avatar
 
Jelte Jansen committed
103
    asio::local::stream_protocol::socket socket_;
104 105
    uint32_t data_length_;
    boost::function<void()> user_handler_;
106
    asio::error_code error_;
107
    size_t timeout_;
Jelte Jansen's avatar
Jelte Jansen committed
108 109 110 111 112 113 114 115 116 117

    // By default, unless changed or disabled, blocking reads on
    // the msgq channel will time out after 4 seconds in this
    // implementation.
    // This number is chosen to be low enough so that whatever
    // component is blocking does not seem to be hanging, but
    // still gives enough time for other modules to respond if they
    // are busy. If this choice turns out to be a bad one, we can
    // change it later.
    static const size_t MSGQ_DEFAULT_TIMEOUT = 4000;
118
};
119

120
void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
121
SessionImpl::establish(const char& socket_file) {
122
    try {
123
        LOG_DEBUG(logger, DBG_TRACE_BASIC, CC_ESTABLISH).arg(&socket_file);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
124 125
        socket_.connect(asio::local::stream_protocol::endpoint(&socket_file),
                        error_);
126
        LOG_DEBUG(logger, DBG_TRACE_BASIC, CC_ESTABLISHED);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
127
    } catch(const asio::system_error& se) {
128
        LOG_FATAL(logger, CC_CONN_ERROR).arg(se.what());
129 130
        isc_throw(SessionError, se.what());
    }
131
    if (error_) {
132
        LOG_FATAL(logger, CC_NO_MSGQ).arg(error_.message());
JINMEI Tatuya's avatar
JINMEI Tatuya committed
133 134
        isc_throw(SessionError, "Unable to connect to message queue: " <<
                  error_.message());
135
    }
136 137 138
}

void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
139
SessionImpl::disconnect() {
140
    LOG_DEBUG(logger, DBG_TRACE_BASIC, CC_DISCONNECT);
141 142
    socket_.close();
    data_length_ = 0;
143 144 145
}

void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
146
SessionImpl::writeData(const void* data, size_t datalen) {
147
    try {
148
        asio::write(socket_, asio::buffer(data, datalen));
149
    } catch (const asio::system_error& asio_ex) {
150
        LOG_FATAL(logger, CC_WRITE_ERROR).arg(asio_ex.what());
151
        isc_throw(SessionError, "ASIO write failed: " << asio_ex.what());
152
    }
153 154
}

155
size_t
JINMEI Tatuya's avatar
JINMEI Tatuya committed
156
SessionImpl::readDataLength() {
157 158 159 160 161
    size_t ret_len = data_length_;
    
    if (ret_len == 0) {
        readData(&data_length_, sizeof(data_length_));
        if (data_length_ == 0) {
162
            LOG_ERROR(logger, CC_LENGTH_NOT_READY);
163 164 165 166 167 168 169 170 171 172
            isc_throw(SessionError, "ASIO read: data length is not ready");
        }
        ret_len = ntohl(data_length_);
    }

    data_length_ = 0;
    return (ret_len);
}

void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
173
SessionImpl::readData(void* data, size_t datalen) {
174 175 176
    boost::optional<asio::error_code> read_result;
    boost::optional<asio::error_code> timer_result;

177
    try {
178
        asio::async_read(socket_, asio::buffer(data, datalen),
179
                         boost::bind(&setResult, &read_result, _1));
180
        asio::deadline_timer timer(socket_.io_service());
181

182 183
        if (getTimeout() != 0) {
            timer.expires_from_now(boost::posix_time::milliseconds(getTimeout()));
184
            timer.async_wait(boost::bind(&setResult, &timer_result, _1));
185
        }
186

187 188 189 190
        // wait until either we have read the data we want, the
        // timer expires, or one of the two is triggered with an error.
        // When one of them has a result, cancel the other, and wait
        // until the cancel is processed before we continue
191
        while (!read_result && !timer_result) {
192
            socket_.io_service().run_one();
Jelte Jansen's avatar
Jelte Jansen committed
193 194

            // Don't cancel the timer if we haven't set it
195
            if (read_result && getTimeout() != 0) {
196
                timer.cancel();
197 198 199
                while (!timer_result) {
                    socket_.io_service().run_one();
                }
200 201
            } else if (timer_result) {
                socket_.cancel();
202 203 204
                while (!read_result) {
                    socket_.io_service().run_one();
                }
205 206
            }
        }
207

208 209
        // asio::error_code evaluates to false if there was no error
        if (*read_result) {
210
            if (*read_result == asio::error::operation_aborted) {
211
                LOG_ERROR(logger, CC_TIMEOUT);
212 213 214
                isc_throw(SessionTimeout,
                          "Timeout while reading data from cc session");
            } else {
215
                LOG_ERROR(logger, CC_READ_ERROR).arg(read_result->message());
216 217 218 219
                isc_throw(SessionError,
                          "Error while reading data from cc session: " <<
                          read_result->message());
            }
220
        }
221
    } catch (const asio::system_error& asio_ex) {
222
        // to hide ASIO specific exceptions, we catch them explicitly
223
        // and convert it to SessionError.
224
        LOG_FATAL(logger, CC_READ_EXCEPTION).arg(asio_ex.what());
225
        isc_throw(SessionError, "ASIO read failed: " << asio_ex.what());
226 227 228 229
    }
}

void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
230
SessionImpl::startRead(boost::function<void()> user_handler) {
231 232
    data_length_ = 0;
    user_handler_ = user_handler;
233 234 235 236 237
    asio::async_read(socket_, asio::buffer(&data_length_,
                                           sizeof(data_length_)),
                     boost::bind(&SessionImpl::internalRead, this,
                                 asio::placeholders::error,
                                 asio::placeholders::bytes_transferred));
238 239 240
}

void
JINMEI Tatuya's avatar
JINMEI Tatuya committed
241
SessionImpl::internalRead(const asio::error_code& error,
242
                          size_t bytes_transferred)
243
{
244 245 246 247
    if (!error) {
        assert(bytes_transferred == sizeof(data_length_));
        data_length_ = ntohl(data_length_);
        if (data_length_ == 0) {
248
            LOG_ERROR(logger, CC_ZERO_LENGTH);
249 250 251 252
            isc_throw(SessionError, "Invalid message length (0)");
        }
        user_handler_();
    } else {
253
        LOG_ERROR(logger, CC_ASYNC_READ_FAILED).arg(error.value());
254 255 256 257
        isc_throw(SessionError, "asynchronous read failed");
    }
}

258 259 260 261
int
SessionImpl::getSocketDesc() {
    /// @todo boost 1.42 uses native() method, but it is deprecated
    /// in 1.49 and native_handle() is recommended instead
262
    if (!socket_.is_open()) {
263
        isc_throw(InvalidOperation, "Can't return socket descriptor: no socket opened.");
264
    }
265 266 267
    return socket_.native();
}

268 269
Session::Session(asio::io_service& io_service) :
    impl_(new SessionImpl(io_service))
JINMEI Tatuya's avatar
JINMEI Tatuya committed
270 271 272 273 274 275 276 277 278 279 280 281 282
{}

Session::~Session() {
    delete impl_;
}

void
Session::disconnect() {
    impl_->disconnect();
}

void
Session::startRead(boost::function<void()> read_callback) {
283
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_START_READ);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
284 285
    impl_->startRead(read_callback);
}
286

287 288 289 290 291
int
Session::getSocketDesc() const {
    return impl_->getSocketDesc();
}

292
namespace {                     // maybe unnecessary.
293 294
// This is a helper class to make the establish() method (below) exception-safe
// with the RAII approach.
295
class SessionHolder {
296
public:
297 298 299 300 301 302 303 304 305
    SessionHolder(SessionImpl* obj) : impl_obj_(obj) {}
    ~SessionHolder()
    {
        if (impl_obj_ != NULL) {
            impl_obj_->disconnect();
        }
    }
    void clear() { impl_obj_ = NULL; }
    SessionImpl* impl_obj_;
306
};
307 308
}

309
void
310
Session::establish(const char* socket_file) {
311 312 313 314 315 316 317 318
    if (socket_file == NULL) {
        socket_file = getenv("BIND10_MSGQ_SOCKET_FILE");
    }
    if (socket_file == NULL) {
        socket_file = BIND10_MSGQ_SOCKET_FILE;
    }

    impl_->establish(*socket_file);
319 320 321 322 323

    // once established, encapsulate the implementation object so that we
    // can safely release the internal resource when exception happens
    // below.
    SessionHolder session_holder(impl_);
324 325 326 327

    //
    // send a request for our local name, and wait for a response
    //
328 329
    ElementPtr get_lname_msg(Element::createMap());
    get_lname_msg->set(CC_HEADER_TYPE, Element::create(CC_COMMAND_GET_LNAME));
330 331
    sendmsg(get_lname_msg);

332
    ConstElementPtr routing, msg;
333
    recvmsg(routing, msg, false);
334

335
    impl_->lname_ = msg->get(CC_PAYLOAD_LNAME)->stringValue();
336
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_LNAME_RECEIVED).arg(impl_->lname_);
337

338 339
    // At this point there's no risk of resource leak.
    session_holder.clear();
340 341 342
}

//
JINMEI Tatuya's avatar
JINMEI Tatuya committed
343 344
// Convert to wire format and send this via the stream socket with its length
// prefix.
345 346
//
void
347 348
Session::sendmsg(ConstElementPtr header) {
    std::string header_wire = header->toWire();
349
    unsigned int length = 2 + header_wire.length();
350
    unsigned int length_net = htonl(length);
351 352
    unsigned short header_length = header_wire.length();
    unsigned short header_length_net = htons(header_length);
353

354 355 356
    impl_->writeData(&length_net, sizeof(length_net));
    impl_->writeData(&header_length_net, sizeof(header_length_net));
    impl_->writeData(header_wire.data(), header_length);
357 358
}

359
void
360 361 362
Session::sendmsg(ConstElementPtr header, ConstElementPtr payload) {
    std::string header_wire = header->toWire();
    std::string body_wire = payload->toWire();
363 364 365 366 367
    unsigned int length = 2 + header_wire.length() + body_wire.length();
    unsigned int length_net = htonl(length);
    unsigned short header_length = header_wire.length();
    unsigned short header_length_net = htons(header_length);

368 369 370 371
    impl_->writeData(&length_net, sizeof(length_net));
    impl_->writeData(&header_length_net, sizeof(header_length_net));
    impl_->writeData(header_wire.data(), header_length);
    impl_->writeData(body_wire.data(), body_wire.length());
372 373
}

374
bool
375 376
Session::recvmsg(ConstElementPtr& msg, bool nonblock, int seq) {
    ConstElementPtr l_env;
JINMEI Tatuya's avatar
JINMEI Tatuya committed
377
    return (recvmsg(l_env, msg, nonblock, seq));
378 379
}

380
bool
381 382 383
Session::recvmsg(ConstElementPtr& env, ConstElementPtr& msg,
                 bool nonblock, int seq)
{
384
    size_t length = impl_->readDataLength();
Jelte Jansen's avatar
Jelte Jansen committed
385
    if (hasQueuedMsgs()) {
386
        ConstElementPtr q_el;
387
        for (size_t i = 0; i < impl_->queue_->size(); i++) {
Jelte Jansen's avatar
Jelte Jansen committed
388 389
            q_el = impl_->queue_->get(i);
            if (( seq == -1 &&
390
                  !q_el->get(0)->contains(CC_HEADER_REPLY)
Jelte Jansen's avatar
Jelte Jansen committed
391
                ) || (
392 393
                  q_el->get(0)->contains(CC_HEADER_REPLY) &&
                  q_el->get(0)->get(CC_HEADER_REPLY)->intValue() == seq
Jelte Jansen's avatar
Jelte Jansen committed
394 395 396 397 398
                )
               ) {
                   env = q_el->get(0);
                   msg = q_el->get(1);
                   impl_->queue_->remove(i);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
399
                   return (true);
Jelte Jansen's avatar
Jelte Jansen committed
400 401 402 403
            }
        }
    }
    
404 405
    unsigned short header_length_net;
    impl_->readData(&header_length_net, sizeof(header_length_net));
406 407

    unsigned short header_length = ntohs(header_length_net);
408
    if (header_length > length || length < 2) {
409
        LOG_ERROR(logger, CC_INVALID_LENGTHS).arg(length).arg(header_length);
410 411 412
        isc_throw(SessionError, "Length parameters invalid: total=" << length
                  << ", header=" << header_length);
    }
413 414 415

    // remove the header-length bytes from the total length
    length -= 2;
416
    std::vector<char> buffer(length);
417
    impl_->readData(&buffer[0], length);
418

419
    std::string header_wire = std::string(&buffer[0], header_length);
420 421
    std::string body_wire = std::string(&buffer[0] + header_length,
                                        length - header_length);
422 423
    std::stringstream header_wire_stream;
    header_wire_stream << header_wire;
424 425
    ConstElementPtr l_env =
        Element::fromWire(header_wire_stream, header_length);
426
    
427 428
    std::stringstream body_wire_stream;
    body_wire_stream << body_wire;
429 430
    ConstElementPtr l_msg =
        Element::fromWire(body_wire_stream, length - header_length);
Jelte Jansen's avatar
Jelte Jansen committed
431
    if ((seq == -1 &&
432
         !l_env->contains(CC_HEADER_REPLY)
Jelte Jansen's avatar
Jelte Jansen committed
433
        ) || (
434 435
         l_env->contains(CC_HEADER_REPLY) &&
         l_env->get(CC_HEADER_REPLY)->intValue() == seq
Jelte Jansen's avatar
Jelte Jansen committed
436 437 438 439
        )
       ) {
        env = l_env;
        msg = l_msg;
JINMEI Tatuya's avatar
JINMEI Tatuya committed
440
        return (true);
Jelte Jansen's avatar
Jelte Jansen committed
441
    } else {
442
        ElementPtr q_el = Element::createList();
Jelte Jansen's avatar
Jelte Jansen committed
443 444 445
        q_el->add(l_env);
        q_el->add(l_msg);
        impl_->queue_->add(q_el);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
446
        return (recvmsg(env, msg, nonblock, seq));
Jelte Jansen's avatar
Jelte Jansen committed
447
    }
448 449 450
    // XXXMLG handle non-block here, and return false for short reads
}

451
void
452
Session::subscribe(std::string group, std::string instance) {
453
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_SUBSCRIBE).arg(group);
454
    ElementPtr env = Element::createMap();
455

456 457 458
    env->set(CC_HEADER_TYPE, Element::create(CC_COMMAND_SUBSCRIBE));
    env->set(CC_HEADER_GROUP, Element::create(group));
    env->set(CC_HEADER_INSTANCE, Element::create(instance));
459 460 461 462 463

    sendmsg(env);
}

void
464
Session::unsubscribe(std::string group, std::string instance) {
465
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_UNSUBSCRIBE).arg(group);
466
    ElementPtr env = Element::createMap();
467

468 469 470
    env->set(CC_HEADER_TYPE, Element::create(CC_COMMAND_UNSUBSCRIBE));
    env->set(CC_HEADER_GROUP, Element::create(group));
    env->set(CC_HEADER_INSTANCE, Element::create(instance));
471 472 473 474

    sendmsg(env);
}

Jelte Jansen's avatar
Jelte Jansen committed
475
int
476
Session::group_sendmsg(ConstElementPtr msg, std::string group,
477
                       std::string instance, std::string to, bool want_answer)
478
{
479 480
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_SEND).arg(msg->str()).
        arg(group);
481
    ElementPtr env = Element::createMap();
482
    const long int nseq = ++impl_->sequence_;
483

484 485 486 487 488 489 490 491
    env->set(CC_HEADER_TYPE,
             Element::create(CC_COMMAND_SEND));
    env->set(CC_HEADER_FROM, Element::create(impl_->lname_));
    env->set(CC_HEADER_TO, Element::create(to));
    env->set(CC_HEADER_GROUP, Element::create(group));
    env->set(CC_HEADER_INSTANCE, Element::create(instance));
    env->set(CC_HEADER_SEQ, Element::create(nseq));
    env->set(CC_HEADER_WANT_ANSWER, Element::create(want_answer));
492

493
    sendmsg(env, msg);
JINMEI Tatuya's avatar
JINMEI Tatuya committed
494
    return (nseq);
495 496 497
}

bool
498
Session::group_recvmsg(ConstElementPtr& envelope, ConstElementPtr& msg,
Jelte Jansen's avatar
Jelte Jansen committed
499
                       bool nonblock, int seq)
500
{
501
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_RECEIVE).arg(seq);
502 503 504 505 506 507 508 509
    bool result(recvmsg(envelope, msg, nonblock, seq));
    if (result) {
        LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_GROUP_RECEIVED).
            arg(envelope->str()).arg(msg->str());
    } else {
        LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_NO_MESSAGE);
    }
    return (result);
510 511
}

Jelte Jansen's avatar
Jelte Jansen committed
512
int
513
Session::reply(ConstElementPtr envelope, ConstElementPtr newmsg) {
514 515
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_REPLY).arg(envelope->str()).
        arg(newmsg->str());
516
    ElementPtr env = Element::createMap();
Jelte Jansen's avatar
Jelte Jansen committed
517
    long int nseq = ++impl_->sequence_;
518

519 520 521 522 523 524 525 526 527 528 529
    env->set(CC_HEADER_TYPE, Element::create(CC_COMMAND_SEND));
    env->set(CC_HEADER_FROM, Element::create(impl_->lname_));
    env->set(CC_HEADER_TO,
             Element::create(envelope->get(CC_HEADER_FROM)->stringValue()));
    env->set(CC_HEADER_GROUP,
             Element::create(envelope->get(CC_HEADER_GROUP)->stringValue()));
    env->set(CC_HEADER_INSTANCE,
             Element::create(envelope->get(CC_HEADER_INSTANCE)->stringValue()));
    env->set(CC_HEADER_SEQ, Element::create(nseq));
    env->set(CC_HEADER_REPLY,
             Element::create(envelope->get(CC_HEADER_SEQ)->intValue()));
530

531
    sendmsg(env, newmsg);
532

JINMEI Tatuya's avatar
JINMEI Tatuya committed
533
    return (nseq);
534
}
Jelte Jansen's avatar
Jelte Jansen committed
535 536

bool
537
Session::hasQueuedMsgs() const {
538
    return (!impl_->queue_->empty());
Jelte Jansen's avatar
Jelte Jansen committed
539 540
}

541 542
void
Session::setTimeout(size_t milliseconds) {
543
    LOG_DEBUG(logger, DBG_TRACE_DETAILED, CC_SET_TIMEOUT).arg(milliseconds);
544 545 546 547
    impl_->setTimeout(milliseconds);
}

size_t
548
Session::getTimeout() const {
Jelte Jansen's avatar
Jelte Jansen committed
549
    return (impl_->getTimeout());
550
}
551
}
552
}