Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 08:52:41

0001 //
0002 // Copyright (c) 2019-2025 Ruben Perez Hidalgo (rubenperez038 at gmail dot com)
0003 //
0004 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0005 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0006 //
0007 
0008 #ifndef BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_STATEMENT_HPP
0009 #define BOOST_MYSQL_IMPL_INTERNAL_SANSIO_CLOSE_STATEMENT_HPP
0010 
0011 #include <boost/mysql/detail/algo_params.hpp>
0012 #include <boost/mysql/detail/pipeline.hpp>
0013 
0014 #include <boost/mysql/impl/internal/protocol/serialization.hpp>
0015 #include <boost/mysql/impl/internal/sansio/connection_state_data.hpp>
0016 
0017 namespace boost {
0018 namespace mysql {
0019 namespace detail {
0020 
0021 inline run_pipeline_algo_params setup_close_statement_pipeline(
0022     connection_state_data& st,
0023     close_statement_algo_params params
0024 )
0025 {
0026     // Pipeline a ping with the close statement, to avoid delays on old connections
0027     // that don't set tcp_nodelay. Both requests are small and fixed size, so
0028     // we don't enforce any buffer limits here.
0029     st.write_buffer.clear();
0030     auto seqnum1 = serialize_top_level_checked(close_stmt_command{params.stmt_id}, st.write_buffer);
0031     auto seqnum2 = serialize_top_level_checked(ping_command{}, st.write_buffer);
0032     st.shared_pipeline_stages = {
0033         {
0034          {pipeline_stage_kind::close_statement, seqnum1, {}},
0035          {pipeline_stage_kind::ping, seqnum2, {}},
0036          }
0037     };
0038     return {st.write_buffer, st.shared_pipeline_stages, nullptr};
0039 }
0040 
0041 }  // namespace detail
0042 }  // namespace mysql
0043 }  // namespace boost
0044 
0045 #endif