Skip to content

Commit aa65195

Browse files
committed
minor fix
Signed-off-by: Emelia Lei <[email protected]>
1 parent 3cb4c24 commit aa65195

File tree

4 files changed

+17
-51
lines changed

4 files changed

+17
-51
lines changed

src/groups/mqb/mqba/mqba_authenticator.cpp

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,22 +66,10 @@ int Authenticator::onAuthenticationRequest(
6666
bmqp_ctrlmsg::AuthenticateResponse& response =
6767
authenticationResponse.makeAuthenticateResponse();
6868

69-
// TODO: authenticate
70-
if (authenticateRequest.mechanism() == "") {
71-
BALL_LOG_ERROR << "Error on authentication";
72-
73-
bmqu::MemOutStream os;
74-
os << "Mechanism is unspecified";
75-
response.status().category() =
76-
bmqp_ctrlmsg::StatusCategory::E_NOT_SUPPORTED;
77-
response.status().message() = os.str();
78-
response.status().code() = -1;
79-
}
80-
else {
81-
response.status().category() = bmqp_ctrlmsg::StatusCategory::E_SUCCESS;
82-
response.status().code() = 0;
83-
response.lifetimeMs() = 10 * 60 * 1000;
84-
}
69+
// Always succeeds for now
70+
response.status().category() = bmqp_ctrlmsg::StatusCategory::E_SUCCESS;
71+
response.status().code() = 0;
72+
response.lifetimeMs() = 10 * 60 * 1000;
8573

8674
int rc = sendAuthenticationMessage(errorDescription,
8775
authenticationResponse,
@@ -113,7 +101,6 @@ int Authenticator::sendAuthenticationMessage(
113101

114102
bmqp::EncodingType::Enum encodingType = bmqp::EncodingType::e_BER;
115103

116-
// TODO: why do we create a local allocator?
117104
bdlma::LocalSequentialAllocator<2048> localAllocator(d_allocator_p);
118105

119106
bmqp::SchemaEventBuilder builder(d_blobSpPool_p,
@@ -144,14 +131,14 @@ int Authenticator::sendAuthenticationMessage(
144131
void Authenticator::initiateOutboundAuthentication(
145132
const AuthenticationContextSp& context)
146133
{
134+
BALL_LOG_ERROR << "Not Implemented";
147135
}
148136

149137
// CREATORS
150138
Authenticator::Authenticator(BlobSpPool* blobSpPool,
151139
bslma::Allocator* allocator)
152140
: d_allocator_p(allocator)
153141
, d_blobSpPool_p(blobSpPool)
154-
, d_clusterCatalog_p(0)
155142
{
156143
// NOTHING
157144
}
@@ -203,7 +190,9 @@ int Authenticator::handleAuthenticationOnMsgType(
203190
int Authenticator::authenticationOutboundOrReverse(
204191
const AuthenticationContextSp& context)
205192
{
206-
return 0;
193+
BALL_LOG_ERROR << "Not Implemented";
194+
195+
return -1;
207196
}
208197

209198
} // close package namespace

src/groups/mqb/mqba/mqba_authenticator.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,6 @@ class Authenticator : public mqbnet::Authenticator {
8686

8787
BlobSpPool* d_blobSpPool_p;
8888

89-
/// Cluster catalog to query for cluster information.
90-
mqbblp::ClusterCatalog* d_clusterCatalog_p;
91-
9289
private:
9390
// NOT IMPLEMENTED
9491

@@ -165,21 +162,6 @@ class Authenticator : public mqbnet::Authenticator {
165162
BSLS_KEYWORD_OVERRIDE;
166163
};
167164

168-
// ============================================================================
169-
// INLINE DEFINITIONS
170-
// ============================================================================
171-
172-
// -------------------
173-
// class Authenticator
174-
// -------------------
175-
176-
inline Authenticator&
177-
Authenticator::setClusterCatalog(mqbblp::ClusterCatalog* value)
178-
{
179-
d_clusterCatalog_p = value;
180-
return *this;
181-
}
182-
183165
} // close package namespace
184166
} // close enterprise namespace
185167

src/groups/mqb/mqba/mqba_initialconnectionhandler.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ int InitialConnectionHandler::processBlob(
208208
context->negotiationContext());
209209
}
210210
else {
211-
errorDescription
212-
<< "Decode NegotiationMessage succeeds but nothing is "
213-
"loaded into the NegotiationMessage.";
211+
errorDescription << "Decode AuthenticationMessage or "
212+
"NegotiationMessage succeeds but nothing gets "
213+
"loaded in.";
214214
rc = (rc * 10) + rc_INVALID_NEGOTIATION_MESSAGE;
215215
}
216216

@@ -246,11 +246,11 @@ int InitialConnectionHandler::decodeInitialConnectionMessage(
246246
return rc_INVALID_MESSAGE; // RETURN
247247
}
248248

249-
bmqp_ctrlmsg::AuthenticationMessage authenticaionMessage;
249+
bmqp_ctrlmsg::AuthenticationMessage authenticationMessage;
250250
bmqp_ctrlmsg::NegotiationMessage negotiationMessage;
251251

252252
if (event.isAuthenticationEvent()) {
253-
const int rc = event.loadAuthenticationEvent(&authenticaionMessage);
253+
const int rc = event.loadAuthenticationEvent(&authenticationMessage);
254254
if (rc != 0) {
255255
BALL_LOG_ERROR
256256
<< "Invalid response from broker [reason: 'authentication "
@@ -259,15 +259,14 @@ int InitialConnectionHandler::decodeInitialConnectionMessage(
259259
return rc_INVALID_AUTHENTICATION_EVENT; // RETURN
260260
}
261261

262-
*authenticationMsg = authenticaionMessage;
262+
*authenticationMsg = authenticationMessage;
263263
}
264264
else if (event.isControlEvent()) {
265265
const int rc = event.loadControlEvent(&negotiationMessage);
266266
if (rc != 0) {
267-
BALL_LOG_ERROR
268-
<< "Invalid response from broker [reason: 'authentication "
269-
"event is not an AuthenticationMessage', rc: "
270-
<< rc << "]: " << event;
267+
BALL_LOG_ERROR << "Invalid response from broker [reason: 'control "
268+
"event is not an NegotiationMessage', rc: "
269+
<< rc << "]: " << event;
271270

272271
return rc_INVALID_CONTROL_EVENT; // RETURN
273272
}

src/groups/mqb/mqba/mqba_initialconnectionhandler.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ namespace BloombergLP {
3838

3939
namespace mqba {
4040

41-
// FORWARD DECLARATION
42-
class SessionNegotiator;
43-
class Authenticator;
44-
4541
// ==============================
4642
// class InitialConnectionHandler
4743
// ==============================

0 commit comments

Comments
 (0)