16 Commits

Author SHA1 Message Date
Jupp Müller
1013aa89bc Fix shutdown bugs by holding loggers in shared_ptrs
This change fixes a shutdown crash occuring when using an
external io_service to drive a websocketpp server. The crash
itself is reproduced by the following code:

```

int main(int argc, const char * argv[])
{
    boost::asio::io_service ioService;
        std::unique_ptr<boost::asio::io_service::work> ioServiceWork(new boost::asio::io_service::work(ioService));
            std::thread ioServiceThread(boost::bind(&boost::asio::io_service::run, &ioService));

    {
        auto server = std::unique_ptr<websocketpp::server<websocketpp::config::asio>>(new websocketpp::server<websocketpp::config::asio>());
        server->init_asio(&ioService);
        server->listen(0);
        server->start_accept();

        server->stop();
    }

    ioServiceWork.reset();
    ioService.stop();
    ioServiceThread.join();

    return 0;
}
```

The cause of the crash is a dangling pointer to alog or elog objects in endpoints.
This is mitigated by storing logging objects as shared_ptrs. This ensures that
they are kept alive and able to log even if their owning structures have already
been deallocated.
2016-03-31 16:49:16 +02:00
Peter Thorson
918745a7ea Add test case for un-setting a handler (with NULL) 2016-02-26 06:20:53 -05:00
Peter Thorson
39dbe3a4e0 adds a vectored write handler for iostream transport 2015-03-04 18:42:55 -06:00
Peter Thorson
18994f7318 Add write_handler to iostream as an ostream replacement 2014-12-04 09:12:57 -05:00
Peter Thorson
7404b506db Add shutdown handler to iostream transport references #388 2014-12-04 08:15:57 -05:00
Peter Thorson
4100fc3ce7 normalize copyright dates and prep release version 2014-11-04 07:31:24 -05:00
Peter Thorson
d6c9905e80 fixes another shadowing warning 2014-10-07 10:16:28 -04:00
Peter Thorson
e8d25d22bc adds documentation and removes unused parameters references #376 2014-10-07 10:04:54 -04:00
Peter Thorson
6c242b205b detab entire project references #376 2014-10-06 18:33:55 -04:00
Peter Thorson
af7149ae0a Adds read_all method to iostream transport
Adds `connection::read_all(...)` method to iostream transport as a
convenience method for reading all data into the connection buffer
without the end user needing to manually loop on `read_some`.
2014-05-22 21:10:58 -05:00
Peter Thorson
2000746be7 correct misc minor warnings 2014-02-02 15:12:42 -06:00
Peter Thorson
550365df6a updates iostream tests for new safer/less leaky API 2013-09-28 07:57:38 -05:00
Peter Thorson
c017331959 remove trailing whitespace 2013-07-21 07:49:15 -05:00
Peter Thorson
5677b5f400 adds dummy timer support + tests to iostream transport 2013-05-26 20:02:08 -05:00
Peter Thorson
59d7efd1ba updates iostream unit tests 2013-03-17 21:48:43 -05:00
Peter Thorson
0236f0c722 adds lots of iostream transport unit tests 2013-03-17 18:28:46 -05:00