mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-21 00:50:35 +00:00
Merge branch 'master' of github.com:cloudius-systems/seastar into db
This commit is contained in:
@@ -341,6 +341,9 @@ private:
|
||||
friend class future;
|
||||
};
|
||||
|
||||
template<>
|
||||
class promise<void> : public promise<> {};
|
||||
|
||||
template <typename... T> struct is_future : std::false_type {};
|
||||
template <typename... T> struct is_future<future<T...>> : std::true_type {};
|
||||
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#ifndef XENSTORE_HH_
|
||||
#define XENSTORE_HH_
|
||||
|
||||
#include <list>
|
||||
|
||||
extern "C" {
|
||||
#include <xenstore.h>
|
||||
}
|
||||
|
||||
10
net/tcp.hh
10
net/tcp.hh
@@ -915,8 +915,9 @@ void tcp<InetTraits>::tcb::init_from_options(tcp_hdr* th, uint8_t* opt_start, ui
|
||||
|
||||
template <typename InetTraits>
|
||||
void tcp<InetTraits>::tcb::input_handle_listen_state(tcp_hdr* th, packet p) {
|
||||
auto opt_start = p.get_header<uint8_t>(sizeof(tcp_hdr));
|
||||
auto opt_end = opt_start + th->data_offset * 4;
|
||||
auto opt_len = th->data_offset * 4 - sizeof(tcp_hdr);
|
||||
auto opt_start = reinterpret_cast<uint8_t*>(p.get_header(0, th->data_offset * 4)) + sizeof(tcp_hdr);
|
||||
auto opt_end = opt_start + opt_len;
|
||||
p.trim_front(th->data_offset * 4);
|
||||
tcp_seq seg_seq = th->seq;
|
||||
|
||||
@@ -943,8 +944,9 @@ void tcp<InetTraits>::tcb::input_handle_listen_state(tcp_hdr* th, packet p) {
|
||||
|
||||
template <typename InetTraits>
|
||||
void tcp<InetTraits>::tcb::input_handle_syn_sent_state(tcp_hdr* th, packet p) {
|
||||
auto opt_start = p.get_header<uint8_t>(sizeof(tcp_hdr));
|
||||
auto opt_end = opt_start + th->data_offset * 4;
|
||||
auto opt_len = th->data_offset * 4 - sizeof(tcp_hdr);
|
||||
auto opt_start = reinterpret_cast<uint8_t*>(p.get_header(0, th->data_offset * 4)) + sizeof(tcp_hdr);
|
||||
auto opt_end = opt_start + opt_len;
|
||||
p.trim_front(th->data_offset * 4);
|
||||
tcp_seq seg_seq = th->seq;
|
||||
auto seg_ack = th->ack;
|
||||
|
||||
@@ -554,6 +554,7 @@ protected:
|
||||
private:
|
||||
future<> prepare_buffers();
|
||||
void complete_buffer(single_buffer&& b, size_t len);
|
||||
void debug_mode_adjust_fragments();
|
||||
};
|
||||
protected:
|
||||
device* _dev;
|
||||
@@ -666,6 +667,22 @@ qp::rxq::prepare_buffers() {
|
||||
});
|
||||
}
|
||||
|
||||
void
|
||||
qp::rxq::debug_mode_adjust_fragments() {
|
||||
#ifdef DEBUG
|
||||
// For debug mode, reallocate last fragment to detect buffer overruns
|
||||
auto last = _fragments.back();
|
||||
auto sz = last.size;
|
||||
std::unique_ptr<char[], free_deleter> buf(reinterpret_cast<char*>(malloc(sz)));
|
||||
if (!buf) {
|
||||
throw std::bad_alloc();
|
||||
}
|
||||
std::copy_n(last.base, sz, buf.get());
|
||||
_fragments.back() = { buf.get(), sz };
|
||||
_buffers.back() = std::move(buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
qp::rxq::complete_buffer(single_buffer&& bc, size_t len) {
|
||||
auto&& sb = bc[0];
|
||||
@@ -690,6 +707,7 @@ qp::rxq::complete_buffer(single_buffer&& bc, size_t len) {
|
||||
|
||||
// Last buffer
|
||||
if (_remaining_buffers == 0) {
|
||||
debug_mode_adjust_fragments();
|
||||
deleter del;
|
||||
if (_buffers.size() == 1) {
|
||||
del = make_free_deleter(_buffers[0].release());
|
||||
|
||||
Reference in New Issue
Block a user