Skip to content

Commit d34779c

Browse files
committed
tcp: add getter for mempool
1 parent b0a6265 commit d34779c

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

api/net/tcp/tcp.hpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ namespace net {
380380
void set_total_bufsize(const size_t size)
381381
{
382382
total_bufsize_ = size;
383-
mempool.set_total_capacity(total_bufsize_);
383+
mempool_.set_total_capacity(total_bufsize_);
384+
}
385+
386+
const os::mem::Pmr_pool& mempool() {
387+
return mempool_;
384388
}
385389

386390
/**
@@ -546,7 +550,7 @@ namespace net {
546550
Connections connections_;
547551

548552
size_t total_bufsize_;
549-
os::mem::Pmr_pool mempool;
553+
os::mem::Pmr_pool mempool_;
550554

551555
size_t min_bufsize_;
552556
size_t max_bufsize_;

src/net/tcp/tcp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ TCP::TCP(IPStack& inet, bool smp_enable) :
4242
listeners_(),
4343
connections_(),
4444
total_bufsize_{default_total_bufsize},
45-
mempool{total_bufsize_},
45+
mempool_{total_bufsize_},
4646
min_bufsize_{default_min_bufsize}, max_bufsize_{default_max_bufsize},
4747
ports_(inet.tcp_ports()),
4848
writeq(),
@@ -515,7 +515,7 @@ void TCP::add_connection(tcp::Connection_ptr conn) {
515515

516516
debug("<TCP::add_connection> Connection added %s \n", conn->to_string().c_str());
517517
conn->_on_cleanup({this, &TCP::close_connection});
518-
conn->bufalloc = mempool.get_resource();
518+
conn->bufalloc = mempool_.get_resource();
519519
Expects(conn->bufalloc != nullptr);
520520
connections_.emplace(conn->tuple(), conn);
521521
}
@@ -531,7 +531,7 @@ Connection_ptr TCP::create_connection(Socket local, Socket remote, ConnectCallba
531531
)
532532
).first->second;
533533
conn->_on_cleanup({this, &TCP::close_connection});
534-
conn->bufalloc = mempool.get_resource();
534+
conn->bufalloc = mempool_.get_resource();
535535
Expects(conn->bufalloc != nullptr);
536536
return conn;
537537
}

0 commit comments

Comments
 (0)