mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-07-08 09:57:10 +02:00
bin
cmake
module
Base
Core
Entity
Library
Misc
Vendor
AES256
ASIO
include
asio
detail
execution
experimental
generic
impl
ip
local
detail
basic_endpoint.hpp
connect_pair.hpp
datagram_protocol.hpp
stream_protocol.hpp
posix
ssl
traits
ts
windows
any_io_executor.hpp
associated_allocator.hpp
associated_executor.hpp
async_result.hpp
awaitable.hpp
basic_datagram_socket.hpp
basic_deadline_timer.hpp
basic_io_object.hpp
basic_raw_socket.hpp
basic_seq_packet_socket.hpp
basic_serial_port.hpp
basic_signal_set.hpp
basic_socket.hpp
basic_socket_acceptor.hpp
basic_socket_iostream.hpp
basic_socket_streambuf.hpp
basic_stream_socket.hpp
basic_streambuf.hpp
basic_streambuf_fwd.hpp
basic_waitable_timer.hpp
bind_executor.hpp
buffer.hpp
buffered_read_stream.hpp
buffered_read_stream_fwd.hpp
buffered_stream.hpp
buffered_stream_fwd.hpp
buffered_write_stream.hpp
buffered_write_stream_fwd.hpp
buffers_iterator.hpp
co_spawn.hpp
completion_condition.hpp
compose.hpp
connect.hpp
coroutine.hpp
deadline_timer.hpp
defer.hpp
detached.hpp
dispatch.hpp
error.hpp
error_code.hpp
execution.hpp
execution_context.hpp
executor.hpp
executor_work_guard.hpp
handler_alloc_hook.hpp
handler_continuation_hook.hpp
handler_invoke_hook.hpp
high_resolution_timer.hpp
io_context.hpp
io_context_strand.hpp
io_service.hpp
io_service_strand.hpp
is_applicable_property.hpp
is_executor.hpp
is_read_buffered.hpp
is_write_buffered.hpp
multiple_exceptions.hpp
packaged_task.hpp
placeholders.hpp
post.hpp
prefer.hpp
query.hpp
read.hpp
read_at.hpp
read_until.hpp
redirect_error.hpp
require.hpp
require_concept.hpp
serial_port.hpp
serial_port_base.hpp
signal_set.hpp
socket_base.hpp
spawn.hpp
ssl.hpp
static_thread_pool.hpp
steady_timer.hpp
strand.hpp
streambuf.hpp
system_context.hpp
system_error.hpp
system_executor.hpp
system_timer.hpp
this_coro.hpp
thread.hpp
thread_pool.hpp
time_traits.hpp
unyield.hpp
use_awaitable.hpp
use_future.hpp
uses_executor.hpp
version.hpp
wait_traits.hpp
write.hpp
write_at.hpp
yield.hpp
Makefile.am
asio.hpp
src
COPYING
INSTALL
LICENSE_1_0.txt
Makefile.am
README
asio.manifest
autogen.sh
boost_asio.manifest
boostify.pl
configure.ac
release.pl
tsify.pl
B64
CPR
CURL
CivetWeb
ConcurrentQueue
Fmt
Hash
MDBC
MaxmindDB
PUGIXML
SQLite
SimpleIni
SimpleSocket
SleepyDiscord
TinyDir
WebSocketPP
Whirlpool
ZLib
CMakeLists.txt
CMakeLists.txt
Core.cpp
Core.hpp
Logger.cpp
Logger.hpp
Main.cpp
Register.cpp
SqBase.hpp
sdk
.gitignore
.gitmodules
CMakeLists.txt
LICENSE
README.md
102 lines
3.1 KiB
C++
102 lines
3.1 KiB
C++
//
|
|
// local/connect_pair.hpp
|
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
|
//
|
|
// Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
//
|
|
|
|
#ifndef ASIO_LOCAL_CONNECT_PAIR_HPP
|
|
#define ASIO_LOCAL_CONNECT_PAIR_HPP
|
|
|
|
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
|
|
# pragma once
|
|
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
|
|
|
|
#include "asio/detail/config.hpp"
|
|
|
|
#if defined(ASIO_HAS_LOCAL_SOCKETS) \
|
|
|| defined(GENERATING_DOCUMENTATION)
|
|
|
|
#include "asio/basic_socket.hpp"
|
|
#include "asio/detail/socket_ops.hpp"
|
|
#include "asio/detail/throw_error.hpp"
|
|
#include "asio/error.hpp"
|
|
#include "asio/local/basic_endpoint.hpp"
|
|
|
|
#include "asio/detail/push_options.hpp"
|
|
|
|
namespace asio {
|
|
namespace local {
|
|
|
|
/// Create a pair of connected sockets.
|
|
template <typename Protocol, typename Executor1, typename Executor2>
|
|
void connect_pair(basic_socket<Protocol, Executor1>& socket1,
|
|
basic_socket<Protocol, Executor2>& socket2);
|
|
|
|
/// Create a pair of connected sockets.
|
|
template <typename Protocol, typename Executor1, typename Executor2>
|
|
ASIO_SYNC_OP_VOID connect_pair(basic_socket<Protocol, Executor1>& socket1,
|
|
basic_socket<Protocol, Executor2>& socket2, asio::error_code& ec);
|
|
|
|
template <typename Protocol, typename Executor1, typename Executor2>
|
|
inline void connect_pair(basic_socket<Protocol, Executor1>& socket1,
|
|
basic_socket<Protocol, Executor2>& socket2)
|
|
{
|
|
asio::error_code ec;
|
|
connect_pair(socket1, socket2, ec);
|
|
asio::detail::throw_error(ec, "connect_pair");
|
|
}
|
|
|
|
template <typename Protocol, typename Executor1, typename Executor2>
|
|
inline ASIO_SYNC_OP_VOID connect_pair(
|
|
basic_socket<Protocol, Executor1>& socket1,
|
|
basic_socket<Protocol, Executor2>& socket2, asio::error_code& ec)
|
|
{
|
|
// Check that this function is only being used with a UNIX domain socket.
|
|
asio::local::basic_endpoint<Protocol>* tmp
|
|
= static_cast<typename Protocol::endpoint*>(0);
|
|
(void)tmp;
|
|
|
|
Protocol protocol;
|
|
asio::detail::socket_type sv[2];
|
|
if (asio::detail::socket_ops::socketpair(protocol.family(),
|
|
protocol.type(), protocol.protocol(), sv, ec)
|
|
== asio::detail::socket_error_retval)
|
|
ASIO_SYNC_OP_VOID_RETURN(ec);
|
|
|
|
socket1.assign(protocol, sv[0], ec);
|
|
if (ec)
|
|
{
|
|
asio::error_code temp_ec;
|
|
asio::detail::socket_ops::state_type state[2] = { 0, 0 };
|
|
asio::detail::socket_ops::close(sv[0], state[0], true, temp_ec);
|
|
asio::detail::socket_ops::close(sv[1], state[1], true, temp_ec);
|
|
ASIO_SYNC_OP_VOID_RETURN(ec);
|
|
}
|
|
|
|
socket2.assign(protocol, sv[1], ec);
|
|
if (ec)
|
|
{
|
|
asio::error_code temp_ec;
|
|
socket1.close(temp_ec);
|
|
asio::detail::socket_ops::state_type state = 0;
|
|
asio::detail::socket_ops::close(sv[1], state, true, temp_ec);
|
|
ASIO_SYNC_OP_VOID_RETURN(ec);
|
|
}
|
|
|
|
ASIO_SYNC_OP_VOID_RETURN(ec);
|
|
}
|
|
|
|
} // namespace local
|
|
} // namespace asio
|
|
|
|
#include "asio/detail/pop_options.hpp"
|
|
|
|
#endif // defined(ASIO_HAS_LOCAL_SOCKETS)
|
|
// || defined(GENERATING_DOCUMENTATION)
|
|
|
|
#endif // ASIO_LOCAL_CONNECT_PAIR_HPP
|