Skip to content

Releases: zhllxt/asio2

v2.9

08 Apr 06:14
Compare
Choose a tag to compare

ChangeLog

  • fix the bug of stack overflow which caused by shutdown_cp and event_queue_cp
  • fix compile error on gcc 10.2.1 and QT

v2.8

30 Dec 03:18
Compare
Choose a tag to compare

ChangeLog

  • Upgrade the asio library to version 1.29.0
  • Upgrade the beast library to version 351 (boost-1.84.0)
  • Upgrade the fmt library to version 9.1.0
  • Add CMake to build the example projects
  • Add mqtt, support mqtt v3.1 v3.1.1 v5.0
  • Change the "_fire_init, _fire_start, _fire_stop" triggered thread from thread main to thread 0.
  • Change the rpc's "call" interface function, before if it is called in the communication thread, it will do nothing, now it will degenerates into async_call and the return value is empty.
  • Change the file "asio2/base/selector.hpp" to "asio2/external/asio.hpp and asio2/external/beast.hpp", used to separate asio and beast header file, previously "included tcp_lient.hpp" will contain both asio and beast, but now "included tcp_lient.hpp" will only contain asio.
  • Change the serial port component which named "scp" to "serial_port".
  • Modify "push_event, next_event" function, to optimized the problem where session_ptr would be copied multiple times.
  • Modify "post, dispatch" function in post_cp.hpp, add "derive.selfptr()" to ensure that the asio::post callback function must hold the session_ptr.
  • Split the original asynchronous function "send" into "send" and "async_send" two functions. Now "send" function means synchronous sending, "async_send" means asynchronous sending (you can find the "send" in your code and replace it with "async_send" directly). Now the return value of the "send" function is the number of bytes of data sent (formerly bool), The return value of "async_send" is void. If the synchronous function "send" is called in the communication thread, it will degenerate into an asynchronous function "async_send";
  • Modify the behavior of the async_send function with the callback parameter, whenever async_send function called fails, such as an exception, the callback will be called. In previous versions, the callback was called only when write data failed.
  • Modify the http::request and http::response in the http callback function to http::web_request and http::web_response, This purpose is to be compatible with boost (you can find http::request in your code and directly replace it with http::web_request. The same is for response. For details, please refer to example/http code example).
  • Remove the "asio::error_code ec" parameter in all callback functions, for example: it used to be bind_start([](asio::error_code ec){}); now it's bind_start({}); Now you need to use asio2::get_last_error(); function to determine whether there is an error; Modified interfaces include: bind_start,bind_stop,bind_connect,bind_disconnect and async_call of rpc callback functions;
  • Remove the error_code parameters in several functions, mainly include http_client::execute,ping::execute,http::make_request,http::make_response, and so on..., now you need to use asio2::get_last_error() to determine whether an error has occurred;
  • Remove "thread_local static error_code ec_ignore;" in asio2/base/error.hpp.
  • Resolve compiling errors under "Visual Studio 2017 - Windows XP (v141_xp)", changed the std::shared_mutex to asio2_shared_mutex marco.
  • Fixed bug : after call server.stop(); in some cases, the server still accept session and the session can "recv send data" normaly. This will cause the server to never exit.
  • Fixed bug : in asio2/base/error.hpp : thread_local static error_code ec_last; In vs2017 and some cases, this maybe cause crash before the "main" function.
  • fixed bug : The reconnect_timer will be invalid when "client.start(...);client.stop();client.start(...);".
  • fixed bug : the _fire_init() notify is not called always in thread 0.
  • fixed bug : Incorrect parsing of filename and content_type in asio2/http/multipart.hpp.
  • fixed bug : asio2/util/ini.hpp, When the exe file name does not contain dot "." , The automatically generated ini file name is incorrect.
  • fixed bug : when call "start" with some exception, the "state" will be "starting", this will cause "start" failed next time forever.
  • fixed bug : it will cause crash when call "client.start" multi times, all "ssl client" and "websocket client" will be affected by this bug, This is because multithreading reads and writes "ws_stream_".
  • fixed bug : The code error traversing "http_router's wildcard_routers_" causes crash.
  • fixed bug : When the timer is stopped immediately after it is started in the io_context thread, the timer will stop fails.
  • fixed bug : If user has called "http::response.defer()" in the recv callback, it maybe cause crash if the session has disconnected before the "defer" has executed, beacuse the "rep_" was destroyed already at this time.
  • fixed bug : If user has called "http::response.defer()" in the recv callback, and the client has not a "keep_alive" option, the response will can not be send to the client correctly.
  • fixed bug : If user has called "http::response.defer()" in the recv callback, the variable "req_" maybe read write in two threads at the same time, and this maybe cause crash.
  • fixed bug : it might find a callback function that does not match the id of rdc component.
  • fixed bug : in some cases, after client.stop(), the client.is_stopped() maybe false.
  • Fixed the problem where kcp server and client did not send fin frame correctly.
  • Fixed the problem where the endian of the KCP handshake data header was not handled correctly.
  • Fixed problem : when the client.stop is called, and at this time the async_send is called in another thread, the async_send maybe has unexpected behavior (e.g. async_send's callback is not called).
  • Fixed unnecessary memory allocation problems in allocator to reduce the number of memory allocation. Now all timers do not use customized allocator to allocate memory, but use asio to allocate memory automatically.
  • [......] Many other general enhancements, code fixes and improvements. See the commits records between 2020-12-23 and 2023-12-30.

Compilers Tested

  • Ubuntu 20.04:
    • GCC, Debug Release x64, C++17: 10.5.0
    • GCC, Debug Release x64, C++20: 10.5.0
  • MacOS 10.15:
    • Clion 2022.2.4, Release x64, C++17
  • Windows:
    • Visual C++: Debug Release x64 x86, C++17, C++20, C++ latest, vs2022(v143), vs2019(v142), vs2017(v141), vs2017(v141_xp)
    • LLVM (clang-cl): Debug Release x64 x86, C++17, C++20, C++ latest
  • NDK:
    • Debug Release x64, C++17, C++20

Unit Tested

  • Ubuntu 20.04:
    • GCC, Debug Release x64, C++17: 10.5.0
    • GCC, Debug Release x64, C++20: 10.5.0
  • MacOS 10.15:
    • Clion 2022.2.4, Release x64, C++17
  • Windows:
    • Visual C++: Debug Release x64 x86, C++17, C++20, C++ latest, vs2022(v143), vs2019(v142), vs2017(v141), vs2017(v141_xp)
    • LLVM (clang-cl): Debug Release x64 x86, C++17, C++20, C++ latest

v2.7

23 Dec 12:43
Compare
Choose a tag to compare

Add remote data call ability.
Other general enhancements.

v2.6

25 Sep 01:47
Compare
Choose a tag to compare

Fixed a bug in the connect_timeout_cp class that caused the program to crash.
Fixed a bug in the ws_stream_cp class that causes program assertions to fail under debug mode.
Fixed a bug in the rpc module that caused the program to crash after receiving illegal data.
Rewrote the rpc_call_cp class code to support chained calls.
Rewrote the api of http and websocket class.
Rewrote the example code.
Fixed and optimized the code for auto reconnection.
A standalone version of Beast was added to support headonly http and websocket capabilities,now all functionality is no longer dependent on the Boost library.
Rename the timeout function of rpc_client and rpc_session class to default_timeout function.
Fixed compile warnings and errors under clang. Compiled under msvc(vs2017 vs2019) gcc8.2.0 clang10.
Add event_guard class to enhance the reliability of event handle.
Remove some class, the files is : httpws_server.hpp,httpws_session.hpp,httpwss_server.hpphttpwss_session.hpp;
Various code fixes and improvements.

v2.5

24 Sep 10:39
Compare
Choose a tag to compare

There are some bugs in this version. These bugs have been fixed in the new version. Please use v2.6
The bugs that have been fixed are as follows:
Fixed a bug in the connect_timeout_cp class that caused the program to crash.
Fixed a bug in the ws_stream_cp class that causes program assertions to fail under debug mode.
Fixed a bug in the rpc module that caused the program to crash after receiving illegal data.