Skip to content

Commit

Permalink
Fix absend of unwrap_connection for the transaction
Browse files Browse the repository at this point in the history
Problem: io_deadline_handler relays on unwrapped Connection address,
for the transaction it may change during setup of request operation
context, so refernce on the underlying Connection object is needed.
  • Loading branch information
thed636 committed May 13, 2020
1 parent ab16283 commit a7e1fa7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions include/ozo/impl/transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ struct is_null_impl<transaction<Ts...>> {
}
};

template <typename ...Ts>
struct unwrap_connection_impl<transaction<Ts...>>{
template <typename Conn>
static constexpr decltype(auto) apply(Conn&& conn) noexcept {
return conn.lowest_layer();
}
};

static_assert(!std::is_same_v<
decltype(ozo::unwrap_connection(std::declval<ozo::transaction<ozo::connection<ozo::empty_oid_map, ozo::no_statistics>, decltype(ozo::make_options())>>())),
decltype(std::declval<ozo::transaction<ozo::connection<ozo::empty_oid_map, ozo::no_statistics>, decltype(ozo::make_options())>>())>,
"ozo::unwrap_connection() should return underlying connection");

static_assert(std::is_same_v<
decltype(ozo::unwrap_connection(std::declval<ozo::transaction<ozo::connection<ozo::empty_oid_map, ozo::no_statistics>, decltype(ozo::make_options())>>())),
decltype(std::declval<ozo::transaction<ozo::connection<ozo::empty_oid_map, ozo::no_statistics>, decltype(ozo::make_options())>>().lowest_layer())>,
"ozo::unwrap_connection() should return underlying connection");

namespace detail {

template <typename Handler, typename Options>
Expand Down

0 comments on commit a7e1fa7

Please sign in to comment.