mirror of
https://github.com/espressif/esp-protocols.git
synced 2025-07-28 01:37:29 +02:00
feat(asio): Drop esp/asio patches in favor of sock-utils
This commit is contained in:
2
.gitmodules
vendored
2
.gitmodules
vendored
@ -1,6 +1,6 @@
|
|||||||
[submodule "components/asio/asio"]
|
[submodule "components/asio/asio"]
|
||||||
path = components/asio/asio
|
path = components/asio/asio
|
||||||
url = https://github.com/espressif/asio
|
url = https://github.com/chriskohlhoff/asio
|
||||||
[submodule "components/mosquitto/mosquitto"]
|
[submodule "components/mosquitto/mosquitto"]
|
||||||
path = components/mosquitto/mosquitto
|
path = components/mosquitto/mosquitto
|
||||||
url = https://github.com/eclipse/mosquitto
|
url = https://github.com/eclipse/mosquitto
|
||||||
|
@ -6,8 +6,8 @@ if(NOT CONFIG_LWIP_IPV6 AND NOT CMAKE_BUILD_EARLY_EXPANSION)
|
|||||||
return()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(asio_sources "asio/asio/src/asio.cpp")
|
set(asio_sources "asio/asio/src/asio.cpp" "port/src/asio_stub.cpp")
|
||||||
set(asio_requires lwip)
|
set(asio_requires lwip sock_utils)
|
||||||
|
|
||||||
if(CONFIG_ASIO_SSL_SUPPORT)
|
if(CONFIG_ASIO_SSL_SUPPORT)
|
||||||
list(APPEND asio_sources
|
list(APPEND asio_sources
|
||||||
@ -18,7 +18,7 @@ if(CONFIG_ASIO_SSL_SUPPORT)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
idf_component_register(SRCS ${asio_sources}
|
idf_component_register(SRCS ${asio_sources}
|
||||||
INCLUDE_DIRS "asio/asio/include" "port/include"
|
INCLUDE_DIRS "port/include" "asio/asio/include"
|
||||||
PRIV_INCLUDE_DIRS ${asio_priv_includes}
|
PRIV_INCLUDE_DIRS ${asio_priv_includes}
|
||||||
PRIV_REQUIRES ${asio_requires})
|
PRIV_REQUIRES ${asio_requires})
|
||||||
|
|
||||||
@ -30,6 +30,7 @@ target_compile_definitions(${COMPONENT_LIB} PUBLIC SA_RESTART=0x01
|
|||||||
ASIO_STANDALONE
|
ASIO_STANDALONE
|
||||||
ASIO_HAS_PTHREADS
|
ASIO_HAS_PTHREADS
|
||||||
OPENSSL_NO_ENGINE
|
OPENSSL_NO_ENGINE
|
||||||
|
ASIO_DETAIL_IMPL_POSIX_EVENT_IPP # this replaces asio's posix_event constructor
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT CONFIG_COMPILER_CXX_EXCEPTIONS)
|
if(NOT CONFIG_COMPILER_CXX_EXCEPTIONS)
|
||||||
|
Submodule components/asio/asio updated: a2e0f70d61...7609450f71
@ -7,3 +7,5 @@ repository: https://github.com/espressif/esp-protocols.git
|
|||||||
dependencies:
|
dependencies:
|
||||||
idf:
|
idf:
|
||||||
version: ">=5.0"
|
version: ">=5.0"
|
||||||
|
espressif/sock_utils:
|
||||||
|
version: "^0.1"
|
||||||
|
11
components/asio/port/include/asio/detail/config.hpp
Normal file
11
components/asio/port/include/asio/detail/config.hpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
//
|
||||||
|
// SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "sys/socket.h"
|
||||||
|
#include "socketpair.h"
|
||||||
|
|
||||||
|
#include_next "asio/detail/config.hpp"
|
@ -1,12 +0,0 @@
|
|||||||
/*
|
|
||||||
* SPDX-FileCopyrightText: 2018-2023 Espressif Systems (Shanghai) CO LTD
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
|
||||||
*/
|
|
||||||
#ifndef _ESP_ASIO_CONFIG_H_
|
|
||||||
#define _ESP_ASIO_CONFIG_H_
|
|
||||||
|
|
||||||
#define ASIO_SSL_DETAIL_OPENSSL_TYPES_HPP
|
|
||||||
#include "openssl_stub.hpp"
|
|
||||||
|
|
||||||
#endif // _ESP_ASIO_CONFIG_H_
|
|
@ -8,7 +8,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "asio/detail/config.hpp"
|
#include "asio/detail/config.hpp"
|
||||||
#include "openssl_stub.hpp"
|
#include "asio/ssl/detail/openssl_types.hpp"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include "asio/detail/throw_error.hpp"
|
#include "asio/detail/throw_error.hpp"
|
||||||
#include "asio/error.hpp"
|
#include "asio/error.hpp"
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include "asio/detail/config.hpp"
|
#include "asio/detail/config.hpp"
|
||||||
#include "openssl_stub.hpp"
|
#include "asio/ssl/detail/openssl_types.hpp"
|
||||||
#include "asio/detail/throw_error.hpp"
|
#include "asio/detail/throw_error.hpp"
|
||||||
#include "asio/error.hpp"
|
#include "asio/error.hpp"
|
||||||
#include "asio/ssl/detail/engine.hpp"
|
#include "asio/ssl/detail/engine.hpp"
|
||||||
|
36
components/asio/port/src/asio_stub.cpp
Normal file
36
components/asio/port/src/asio_stub.cpp
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// SPDX-FileCopyrightText: 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
|
//
|
||||||
|
// SPDX-FileContributor: 2024 Espressif Systems (Shanghai) CO LTD
|
||||||
|
//
|
||||||
|
#include "asio/detail/posix_event.hpp"
|
||||||
|
#include "asio/detail/throw_error.hpp"
|
||||||
|
#include "asio/error.hpp"
|
||||||
|
#include "asio/detail/push_options.hpp"
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <climits>
|
||||||
|
|
||||||
|
namespace asio::detail {
|
||||||
|
// This replaces asio's posix_event constructor
|
||||||
|
// since the default POSIX version uses pthread_condattr_t operations (init, setclock, destroy),
|
||||||
|
// which are not available on all IDF versions (some are defined in compilers' headers, others in
|
||||||
|
// pthread library, but they typically return `ENOSYS` which causes trouble in the event wrapper)
|
||||||
|
// IMPORTANT: Check implementation of posix_event() when upgrading upstream asio in order not to
|
||||||
|
// miss any initialization step.
|
||||||
|
posix_event::posix_event()
|
||||||
|
: state_(0)
|
||||||
|
{
|
||||||
|
int error = ::pthread_cond_init(&cond_, nullptr);
|
||||||
|
asio::error_code ec(error, asio::error::get_system_category());
|
||||||
|
asio::detail::throw_error(ec, "event");
|
||||||
|
}
|
||||||
|
} // namespace asio::detail
|
||||||
|
|
||||||
|
extern "C" int pause (void)
|
||||||
|
{
|
||||||
|
while (true) {
|
||||||
|
::sleep(UINT_MAX);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user