From 974765fa243a2cc4ac574872cdb1723f2a6c5bd4 Mon Sep 17 00:00:00 2001 From: Gammasoft Date: Wed, 4 Oct 2023 16:34:41 +0200 Subject: [PATCH] update async_callback alias --- src/xtd.core/include/xtd/delegate.h | 2 +- .../include/xtd/internal/__delegate.h | 4 ++-- src/xtd.core/src/xtd/net/sockets/socket.cpp | 20 +++++++++---------- .../src/xtd/net/sockets/tcp_listener.cpp | 4 ++-- .../src/xtd/net/sockets/udp_client.cpp | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/xtd.core/include/xtd/delegate.h b/src/xtd.core/include/xtd/delegate.h index 0c84fd0a57bc..37589087d2db 100644 --- a/src/xtd.core/include/xtd/delegate.h +++ b/src/xtd.core/include/xtd/delegate.h @@ -31,7 +31,7 @@ namespace xtd { /// @par Library /// xtd.core /// @ingroup xtd_core - using async_callback = delegate; + using async_callback = delegate; /// @brief Represents a delegate, which is a data structure that refers to a static method or to a class instance && an instance method of that class. /// @par Header diff --git a/src/xtd.core/include/xtd/internal/__delegate.h b/src/xtd.core/include/xtd/internal/__delegate.h index b14f15a849b1..ab5f904ccf5e 100644 --- a/src/xtd.core/include/xtd/internal/__delegate.h +++ b/src/xtd.core/include/xtd/internal/__delegate.h @@ -95,7 +95,7 @@ xtd::iasync_result_ptr xtd::delegate::begin_invoke(xtd::async_callba async->data_->result = __xtd_delegate_invoker(function_t {std::bind(&xtd::delegate::invoke, this)}); async->data_->is_completed = true; async->data_->async_event.set(); - async->data_->async_callback(async); + async->data_->async_callback(*async); }); return async; } @@ -159,7 +159,7 @@ xtd::iasync_result_ptr xtd::delegate::begin_invoke(xtd async->data_->result = __xtd_delegate_invoker(function_t {std::bind(&xtd::delegate::invoke, this, arguments...)}, arguments...); async->data_->is_completed = true; async->data_->async_event.set(); - async->data_->async_callback(async); + async->data_->async_callback(*async); }); return async; } diff --git a/src/xtd.core/src/xtd/net/sockets/socket.cpp b/src/xtd.core/src/xtd/net/sockets/socket.cpp index 0c494a725ecf..6e9be4185643 100644 --- a/src/xtd.core/src/xtd/net/sockets/socket.cpp +++ b/src/xtd.core/src/xtd/net/sockets/socket.cpp @@ -332,7 +332,7 @@ std::shared_ptr socket::begin_accept(xtd::async_callback cal ar->socket_ = s.accept(); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -369,7 +369,7 @@ std::shared_ptr socket::begin_disconnect(bool reuse_socket, s.disconnect(reuse_socket); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -391,7 +391,7 @@ std::shared_ptr socket::begin_receive(std::vector ar->number_of_bytes_received_ = s.receive(*buffer, offset, size, socket_flags); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -413,7 +413,7 @@ std::shared_ptr socket::begin_receive(std::vector ar->number_of_bytes_received_ = s.receive(*buffer, offset, size, socket_flags, ar->error_code_); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -435,7 +435,7 @@ std::shared_ptr socket::begin_receive_from(std::vectornumber_of_bytes_received_ = s.receive_from(*buffer, offset, size, socket_flags, *ar->end_point_); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -458,7 +458,7 @@ std::shared_ptr socket::begin_receive_message_from(std::vect ar->number_of_bytes_received_ = s.receive_message_from(*buffer, offset, size, ar->socket_flags_, *ar->end_point_, ar->ip_packet_information_); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -480,7 +480,7 @@ std::shared_ptr socket::begin_send(const std::vectornumber_of_bytes_sent_ = s.send(buffer, offset, size, socket_flags); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -502,7 +502,7 @@ std::shared_ptr socket::begin_send(const std::vectornumber_of_bytes_sent_ = s.send(buffer, offset, size, socket_flags, ar->error_code_); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -523,7 +523,7 @@ std::shared_ptr socket::begin_send_to(const std::vectornumber_of_bytes_sent_ = s.send_to(buffer, offset, size, socket_flags, remote_end_point); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); @@ -950,7 +950,7 @@ std::shared_ptr socket::begin_connect_(std::shared_ptris_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->error_code_ = s.get_last_error_(); ar->exception_ = current_exception(); diff --git a/src/xtd.core/src/xtd/net/sockets/tcp_listener.cpp b/src/xtd.core/src/xtd/net/sockets/tcp_listener.cpp index bbb8c16f814c..4c13eb297ddf 100644 --- a/src/xtd.core/src/xtd/net/sockets/tcp_listener.cpp +++ b/src/xtd.core/src/xtd/net/sockets/tcp_listener.cpp @@ -66,7 +66,7 @@ std::shared_ptr tcp_listener::begin_accept_socket(xtd::async ar->socket_ = listener->accept_socket(); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); } @@ -83,7 +83,7 @@ std::shared_ptr tcp_listener::begin_accept_tcp_client(xtd::a ar->tcp_client_ = listener->accept_tcp_client(); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); } diff --git a/src/xtd.core/src/xtd/net/sockets/udp_client.cpp b/src/xtd.core/src/xtd/net/sockets/udp_client.cpp index 55a68478e318..314015982b51 100644 --- a/src/xtd.core/src/xtd/net/sockets/udp_client.cpp +++ b/src/xtd.core/src/xtd/net/sockets/udp_client.cpp @@ -122,7 +122,7 @@ std::shared_ptr udp_client::begin_receive(xtd::async_callbac ar->buffer_ = udp_client->receive(ar->remote_end_point_); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); } @@ -139,7 +139,7 @@ std::shared_ptr udp_client::begin_send(const std::vectornumber_of_bytes_sent_ = udp_client->send(dgram, bytes, hostname, port); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); } @@ -156,7 +156,7 @@ std::shared_ptr udp_client::begin_send(const std::vectornumber_of_bytes_sent_ = udp_client->send(dgram, bytes, end_point); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); } @@ -173,7 +173,7 @@ std::shared_ptr udp_client::begin_send(const std::vectornumber_of_bytes_sent_ = udp_client->send(dgram, bytes); ar->is_completed_ = true; as(ar->async_wait_handle()).release_mutex(); - callback(ar); + callback(*ar); } catch (...) { ar->exception_ = current_exception(); }