diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-01-29 20:00:59 +0000 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-01-29 20:00:59 +0000 |
| commit | 27867be66579551018c926ed3339624e463c1b08 (patch) | |
| tree | 27c6482b10a0327be4ffb510859dd85cfd7fa9a1 /src | |
| parent | 00ee110ef1de083759c4f74bdfeff78752b6198f (diff) | |
Remove unused socket stuff.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/dcpomatic_socket.cc | 32 | ||||
| -rw-r--r-- | src/lib/dcpomatic_socket.h | 3 |
2 files changed, 1 insertions, 34 deletions
diff --git a/src/lib/dcpomatic_socket.cc b/src/lib/dcpomatic_socket.cc index bc8f596a7..d575e3230 100644 --- a/src/lib/dcpomatic_socket.cc +++ b/src/lib/dcpomatic_socket.cc @@ -28,27 +28,17 @@ Socket::Socket (int timeout) : _deadline (_io_service) , _socket (_io_service) - , _acceptor (0) , _timeout (timeout) { _deadline.expires_at (boost::posix_time::pos_infin); check (); } -Socket::~Socket () -{ - delete _acceptor; -} - void Socket::check () { if (_deadline.expires_at() <= boost::asio::deadline_timer::traits_type::now ()) { - if (_acceptor) { - _acceptor->cancel (); - } else { - _socket.close (); - } + _socket.close (); _deadline.expires_at (boost::posix_time::pos_infin); } @@ -77,26 +67,6 @@ Socket::connect (boost::asio::ip::tcp::endpoint endpoint) } } -void -Socket::accept (int port) -{ - _acceptor = new boost::asio::ip::tcp::acceptor (_io_service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)); - - _deadline.expires_from_now (boost::posix_time::seconds (_timeout)); - boost::system::error_code ec = boost::asio::error::would_block; - _acceptor->async_accept (_socket, boost::lambda::var(ec) = boost::lambda::_1); - do { - _io_service.run_one (); - } while (ec == boost::asio::error::would_block); - - delete _acceptor; - _acceptor = 0; - - if (ec) { - throw NetworkError (String::compose (_("error during async_accept (%1)"), ec.value ())); - } -} - /** Blocking write. * @param data Buffer to write. * @param size Number of bytes to write. diff --git a/src/lib/dcpomatic_socket.h b/src/lib/dcpomatic_socket.h index b9859f600..82ca5ff69 100644 --- a/src/lib/dcpomatic_socket.h +++ b/src/lib/dcpomatic_socket.h @@ -30,7 +30,6 @@ class Socket : public boost::noncopyable { public: Socket (int timeout = 30); - ~Socket (); /** @return Our underlying socket */ boost::asio::ip::tcp::socket& socket () { @@ -38,7 +37,6 @@ public: } void connect (boost::asio::ip::tcp::endpoint); - void accept (int); void write (uint32_t n); void write (uint8_t const * data, int size); @@ -54,6 +52,5 @@ private: boost::asio::io_service _io_service; boost::asio::deadline_timer _deadline; boost::asio::ip::tcp::socket _socket; - boost::asio::ip::tcp::acceptor* _acceptor; int _timeout; }; |
