Skip to content

Commit

Permalink
[BMQ]: Fix leaking internal headers in bmqa_mocksession
Browse files Browse the repository at this point in the history
Also fixes an incorrect change that marked bmqt as a private package

Signed-off-by: Taylor Foxhall <[email protected]>
  • Loading branch information
hallfox committed Oct 29, 2024
1 parent 0f582f0 commit 9eeea2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/groups/bmq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ set(BMQ_PRIVATE_PACKAGES
bmqst
bmqstm
bmqsys
bmqt
bmqtsk
bmqtst
bmqu
bmqvt
)
target_bmq_style_uor( bmq PRIVATE_PACKAGES ${BMQ_PRIVATE_PACKAGES} )

Expand Down
13 changes: 8 additions & 5 deletions src/groups/bmq/bmqa/bmqa_mocksession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <bmqp_protocol.h>
#include <bmqp_protocolutil.h>
#include <bmqp_pusheventbuilder.h>
#include <bmqst_statcontext.h>
#include <bmqsys_time.h>
#include <bmqt_messageguid.h>
#include <bmqt_uri.h>
Expand Down Expand Up @@ -742,7 +743,7 @@ void MockSession::initializeStats()
start.setLevel(0).setIndex(0);
end.setLevel(0).setIndex(1);
bmqimp::QueueStatsUtil::initializeStats(d_queuesStats_sp.get(),
&d_rootStatContext,
d_rootStatContext_mp.get(),
start,
end,
d_allocator_p);
Expand Down Expand Up @@ -961,8 +962,9 @@ MockSession::MockSession(const bmqt::SessionOptions& options,
bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
, d_postedEvents(bslma::Default::allocator(allocator))
, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator),
allocator)
, d_rootStatContext_mp(bslma::ManagedPtrUtil::makeManaged<bmqst::StatContext>(
bmqst::StatContextConfiguration("MockSession", allocator),
allocator))
, d_queuesStats_sp(new(*bslma::Default::allocator(allocator))
bmqimp::Stat(bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
Expand Down Expand Up @@ -1004,8 +1006,9 @@ MockSession::MockSession(bslma::ManagedPtr<SessionEventHandler> eventHandler,
bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
, d_postedEvents(bslma::Default::allocator(allocator))
, d_rootStatContext(bmqst::StatContextConfiguration("MockSession", allocator),
allocator)
, d_rootStatContext_mp(bslma::ManagedPtrUtil::makeManaged<bmqst::StatContext>(
bmqst::StatContextConfiguration("MockSession", allocator),
allocator))
, d_queuesStats_sp(new(*bslma::Default::allocator(allocator))
bmqimp::Stat(bslma::Default::allocator(allocator)),
bslma::Default::allocator(allocator))
Expand Down
6 changes: 4 additions & 2 deletions src/groups/bmq/bmqa/bmqa_mocksession.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@
#include <bmqa_openqueuestatus.h>
#include <bmqa_queueid.h>
#include <bmqa_session.h> // for 'bmqa::SessionEventHandler'
#include <bmqst_statcontext.h>
#include <bmqt_queueoptions.h>
#include <bmqt_sessionoptions.h>

Expand Down Expand Up @@ -586,6 +585,9 @@ class MessageCorrelationIdContainer;
namespace bmqimp {
struct Stat;
}
namespace bmqst {
class StatContext;
}

namespace bmqa {

Expand Down Expand Up @@ -1040,7 +1042,7 @@ class MockSession : public AbstractSession {
mutable bslmt::Mutex d_mutex;

/// Top level stat context for this mocked Session.
bmqst::StatContext d_rootStatContext;
bslma::ManagedPtr<bmqst::StatContext> d_rootStatContext_mp;

/// Stats for all queues
StatImplSp d_queuesStats_sp;
Expand Down

0 comments on commit 9eeea2c

Please sign in to comment.