Skip to content

Commit

Permalink
#184 Rejecting incoming connections w/o peer URI
Browse files Browse the repository at this point in the history
Signed-off-by: Vitaly Dzhitenov <[email protected]>
  • Loading branch information
dorjesinpo authored Jan 23, 2024
1 parent 67c47eb commit d470857
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/groups/mqb/mqbnet/mqbnet_tcpsessionfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -674,17 +674,29 @@ void TCPSessionFactory::channelStateCallback(
BSLS_ASSERT_SAFE(status); // got a channel up, it must be success
BSLS_ASSERT_SAFE(channel);

// Keep track of active channels, for logging purposes
++d_nbActiveChannels;
if (channel->peerUri().empty()) {
BALL_LOG_ERROR << "#SESSION_NEGOTIATION "
<< "TCPSessionFactory '" << d_config.name() << "' "
<< "rejecting empty peer URI: '" << channel.get()
<< "'";

mwcio::Status status(mwcio::StatusCategory::e_GENERIC_ERROR,
d_allocator_p);
channel->close(status);
}
else {
// Keep track of active channels, for logging purposes
++d_nbActiveChannels;

// Register as observer of the channel to get the 'onClose'
channel->onClose(
bdlf::BindUtil::bind(&TCPSessionFactory::onClose,
this,
channel,
bdlf::PlaceHolders::_1 /* mwcio::Status */));
// Register as observer of the channel to get the 'onClose'
channel->onClose(bdlf::BindUtil::bind(
&TCPSessionFactory::onClose,
this,
channel,
bdlf::PlaceHolders::_1 /* mwcio::Status */));

negotiate(channel, context);
negotiate(channel, context);
}
} break;
case mwcio::ChannelFactoryEvent::e_CONNECT_ATTEMPT_FAILED: {
// Nothing
Expand Down

0 comments on commit d470857

Please sign in to comment.