summaryrefslogtreecommitdiff
path: root/implementation/endpoints
diff options
context:
space:
mode:
Diffstat (limited to 'implementation/endpoints')
-rw-r--r--implementation/endpoints/include/tcp_server_endpoint_impl.hpp1
-rw-r--r--implementation/endpoints/include/udp_server_endpoint_impl.hpp1
-rw-r--r--implementation/endpoints/src/local_client_endpoint_impl.cpp11
-rw-r--r--implementation/endpoints/src/tcp_server_endpoint_impl.cpp20
-rw-r--r--implementation/endpoints/src/udp_server_endpoint_impl.cpp11
5 files changed, 36 insertions, 8 deletions
diff --git a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
index 57f0566..7295868 100644
--- a/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/tcp_server_endpoint_impl.hpp
@@ -36,6 +36,7 @@ public:
void send_queued(queue_iterator_type _queue_iterator);
endpoint_type get_remote() const;
+ bool get_remote_address(boost::asio::ip::address &_address) const;
bool get_multicast(service_t, event_t, endpoint_type &) const;
unsigned short get_local_port() const;
diff --git a/implementation/endpoints/include/udp_server_endpoint_impl.hpp b/implementation/endpoints/include/udp_server_endpoint_impl.hpp
index d7e2b62..c03a7b4 100644
--- a/implementation/endpoints/include/udp_server_endpoint_impl.hpp
+++ b/implementation/endpoints/include/udp_server_endpoint_impl.hpp
@@ -36,6 +36,7 @@ public:
void send_queued(queue_iterator_type _queue_iterator);
endpoint_type get_remote() const;
+ bool get_remote_address(boost::asio::ip::address &_address) const;
bool get_multicast(service_t _service, event_t _event,
endpoint_type &_target) const;
diff --git a/implementation/endpoints/src/local_client_endpoint_impl.cpp b/implementation/endpoints/src/local_client_endpoint_impl.cpp
index 323c414..116287f 100644
--- a/implementation/endpoints/src/local_client_endpoint_impl.cpp
+++ b/implementation/endpoints/src/local_client_endpoint_impl.cpp
@@ -38,14 +38,9 @@ void local_client_endpoint_impl::start() {
void local_client_endpoint_impl::connect() {
socket_.open(remote_.protocol());
- socket_.async_connect(
- remote_,
- std::bind(
- &local_client_endpoint_base_impl::connect_cbk,
- shared_from_this(),
- std::placeholders::_1
- )
- );
+ boost::system::error_code error;
+ error = socket_.connect(remote_, error);
+ connect_cbk(error);
}
void local_client_endpoint_impl::receive() {
diff --git a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
index 20391a0..0084d8e 100644
--- a/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/tcp_server_endpoint_impl.cpp
@@ -70,6 +70,26 @@ tcp_server_endpoint_impl::get_remote() const {
return current_->get_socket().remote_endpoint();
}
+bool tcp_server_endpoint_impl::get_remote_address(
+ boost::asio::ip::address &_address) const {
+
+ if (current_) {
+ boost::system::error_code its_error;
+ tcp_server_endpoint_impl::endpoint_type its_endpoint =
+ current_->get_socket().remote_endpoint(its_error);
+ if (its_error) {
+ return false;
+ } else {
+ boost::asio::ip::address its_address = its_endpoint.address();
+ if (!its_address.is_unspecified()) {
+ _address = its_address;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
bool tcp_server_endpoint_impl::get_multicast(service_t, event_t,
tcp_server_endpoint_impl::endpoint_type &) const {
return false;
diff --git a/implementation/endpoints/src/udp_server_endpoint_impl.cpp b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
index f29dfba..4593c1f 100644
--- a/implementation/endpoints/src/udp_server_endpoint_impl.cpp
+++ b/implementation/endpoints/src/udp_server_endpoint_impl.cpp
@@ -123,6 +123,17 @@ udp_server_endpoint_impl::get_remote() const {
return remote_;
}
+bool udp_server_endpoint_impl::get_remote_address(
+ boost::asio::ip::address &_address) const {
+ boost::asio::ip::address its_address = remote_.address();
+ if (its_address.is_unspecified()) {
+ return false;
+ } else {
+ _address = its_address;
+ }
+ return true;
+}
+
bool udp_server_endpoint_impl::get_multicast(service_t _service, event_t _event,
udp_server_endpoint_impl::endpoint_type &_target) const {
bool is_valid(false);