Keep server running in spite of send errors to the client.

This commit is contained in:
chris 2003-11-11 06:16:18 +00:00
parent 9776718099
commit c3480f324f

View File

@ -21,17 +21,19 @@ public:
socket_.async_sendto(data_, bytes_recvd, sender_address_, socket_.async_sendto(data_, bytes_recvd, sender_address_,
boost::bind(&server::handle_sendto, this, _1, _2)); boost::bind(&server::handle_sendto, this, _1, _2));
} }
} else
void handle_sendto(const asio::socket_error& error, size_t bytes_sent)
{
if (!error)
{ {
socket_.async_recvfrom(data_, max_length, sender_address_, socket_.async_recvfrom(data_, max_length, sender_address_,
boost::bind(&server::handle_recvfrom, this, _1, _2)); boost::bind(&server::handle_recvfrom, this, _1, _2));
} }
} }
void handle_sendto(const asio::socket_error& error, size_t bytes_sent)
{
socket_.async_recvfrom(data_, max_length, sender_address_,
boost::bind(&server::handle_recvfrom, this, _1, _2));
}
private: private:
asio::demuxer& demuxer_; asio::demuxer& demuxer_;
asio::dgram_socket socket_; asio::dgram_socket socket_;