Remove uses of boost::throw_exception.

This commit is contained in:
chris 2003-09-28 03:11:24 +00:00
parent 3a90b222d0
commit 8fdf8bd148
4 changed files with 18 additions and 22 deletions

View File

@ -19,7 +19,6 @@
#include "asio/detail/push_options.hpp"
#include <boost/bind.hpp>
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/completion_context.hpp"
@ -60,7 +59,7 @@ public:
socket_holder sock(socket_ops::socket(address.family(), SOCK_DGRAM,
IPPROTO_UDP));
if (sock.get() == invalid_socket)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
int reuse = 1;
socket_ops::setsockopt(sock.get(), SOL_SOCKET, SO_REUSEADDR, &reuse,
@ -68,7 +67,7 @@ public:
if (socket_ops::bind(sock.get(), address.native_address(),
address.native_size()) == socket_error_retval)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
impl = sock.release();
}
@ -93,7 +92,7 @@ public:
int bytes_sent = socket_ops::sendto(impl, data, length, 0,
destination.native_address(), destination.native_size());
if (bytes_sent < 0)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
return bytes_sent;
}
@ -162,7 +161,7 @@ public:
int bytes_recvd = socket_ops::recvfrom(impl, data, max_length, 0,
sender_address.native_address(), &addr_len);
if (bytes_recvd < 0)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
sender_address.native_size(addr_len);
return bytes_recvd;
}

View File

@ -19,7 +19,6 @@
#include "asio/detail/push_options.hpp"
#include <boost/bind.hpp>
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/basic_stream_socket.hpp"
@ -68,7 +67,7 @@ public:
socket_holder sock(socket_ops::socket(address.family(), SOCK_STREAM,
IPPROTO_TCP));
if (sock.get() == invalid_socket)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
int reuse = 1;
socket_ops::setsockopt(sock.get(), SOL_SOCKET, SO_REUSEADDR, &reuse,
@ -76,10 +75,10 @@ public:
if (socket_ops::bind(sock.get(), address.native_address(),
address.native_size()) == socket_error_retval)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
if (socket_ops::listen(sock.get(), listen_queue) == socket_error_retval)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
impl = sock.release();
}
@ -102,11 +101,11 @@ public:
{
// We cannot accept a socket that is already open.
if (peer.impl() != invalid_socket)
boost::throw_exception(socket_error(socket_error::already_connected));
throw socket_error(socket_error::already_connected);
socket_type new_socket = socket_ops::accept(impl, 0, 0);
if (int error = socket_ops::get_error())
boost::throw_exception(socket_error(error));
throw socket_error(error);
peer.set_impl(new_socket);
}
@ -118,13 +117,13 @@ public:
{
// We cannot accept a socket that is already open.
if (peer.impl() != invalid_socket)
boost::throw_exception(socket_error(socket_error::already_connected));
throw socket_error(socket_error::already_connected);
socket_addr_len_type addr_len = peer_address.native_size();
socket_type new_socket = socket_ops::accept(impl,
peer_address.native_address(), &addr_len);
if (int error = socket_ops::get_error())
boost::throw_exception(socket_error(error));
throw socket_error(error);
peer_address.native_size(addr_len);
peer.set_impl(new_socket);

View File

@ -22,7 +22,6 @@
#include <boost/bind.hpp>
#include <boost/noncopyable.hpp>
#include <boost/thread.hpp>
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/basic_stream_socket.hpp"
@ -121,14 +120,14 @@ public:
{
// We cannot connect a socket that is already open.
if (peer.impl() != invalid_socket)
boost::throw_exception(socket_error(socket_error::already_connected));
throw socket_error(socket_error::already_connected);
// Create a new socket for the connection. This will not be put into the
// stream_socket object until the connection has beenestablished.
socket_holder sock(socket_ops::socket(peer_address.family(), SOCK_STREAM,
IPPROTO_TCP));
if (sock.get() == invalid_socket)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
// Perform the connect operation itself.
impl->add_socket(sock.get());
@ -136,7 +135,7 @@ public:
peer_address.native_size());
impl->remove_socket(sock.get());
if (result == socket_error_retval)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
// Connection was successful. The stream_socket object will now take
// ownership of the newly connected native socket handle.

View File

@ -19,7 +19,6 @@
#include "asio/detail/push_options.hpp"
#include <boost/bind.hpp>
#include <boost/throw_exception.hpp>
#include "asio/detail/pop_options.hpp"
#include "asio/completion_context.hpp"
@ -76,7 +75,7 @@ public:
{
int bytes_sent = socket_ops::send(impl, data, length, 0);
if (bytes_sent < 0)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
return bytes_sent;
}
@ -146,7 +145,7 @@ public:
static_cast<const char*>(data) + total_sent, length - total_sent, 0);
if (bytes_sent < 0)
{
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
}
else if (bytes_sent == 0)
{
@ -237,7 +236,7 @@ public:
{
int bytes_recvd = socket_ops::recv(impl, data, max_length, 0);
if (bytes_recvd < 0)
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
return bytes_recvd;
}
@ -307,7 +306,7 @@ public:
static_cast<char*>(data) + total_recvd, length - total_recvd, 0);
if (bytes_recvd < 0)
{
boost::throw_exception(socket_error(socket_ops::get_error()));
throw socket_error(socket_ops::get_error());
}
else if (bytes_recvd == 0)
{