Skip to content

Commit 7e9f698

Browse files
committed
Verify behavior works
1 parent 39b1d18 commit 7e9f698

File tree

3 files changed

+7
-18
lines changed

3 files changed

+7
-18
lines changed

eventstream_rpc/source/EventStreamClient.cpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,7 +1226,7 @@ namespace Aws
12261226
/* Missing required content type header. */
12271227
errorCode = EVENT_STREAM_RPC_UNMAPPED_DATA;
12281228
}
1229-
else if (contentHeader == nullptr && contentHeader->GetValueAsString(contentType) && contentType != CONTENT_TYPE_APPLICATION_JSON)
1229+
else if (contentHeader->GetValueAsString(contentType) && contentType != CONTENT_TYPE_APPLICATION_JSON)
12301230
{
12311231
errorCode = EVENT_STREAM_RPC_UNSUPPORTED_CONTENT_TYPE;
12321232
}
@@ -1309,23 +1309,15 @@ namespace Aws
13091309

13101310
std::future<RpcError> ClientOperation::Close(OnMessageFlushCallback onMessageFlushCallback) noexcept
13111311
{
1312-
if (m_clientContinuation.IsClosed())
1313-
{
1314-
std::promise<RpcError> alreadyClosedPromise;
1315-
alreadyClosedPromise.set_value({EVENT_STREAM_RPC_CONTINUATION_CLOSED, 0});
1316-
return alreadyClosedPromise.get_future();
1317-
}
1318-
else
1319-
{
1320-
auto rpcError = m_clientContinuation.SendMessage(
1312+
std::promise<RpcError> closedPromise;
1313+
closedPromise.set_value(m_clientContinuation.SendMessage(
13211314
Crt::List<EventStreamHeader>(),
13221315
Crt::Optional<Crt::ByteBuf>(),
13231316
AWS_EVENT_STREAM_RPC_MESSAGE_TYPE_APPLICATION_MESSAGE,
13241317
AWS_EVENT_STREAM_RPC_MESSAGE_FLAG_TERMINATE_STREAM,
1325-
onMessageFlushCallback).get();
1326-
m_clientContinuation.Close();
1327-
return m_closedPromise.get_future();
1328-
}
1318+
onMessageFlushCallback).get());
1319+
m_clientContinuation.Close();
1320+
return closedPromise.get_future();
13291321
}
13301322

13311323
void OperationError::s_customDeleter(OperationError *shape) noexcept

eventstream_rpc/tests/EchoTestRpcClient.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace Awstest
1010
{
1111
m_echoTestRpcServiceModel.AssignModelNameToErrorResponse(
1212
Aws::Crt::String("awstest#ServiceError"), ServiceError::s_allocateFromPayload);
13-
aws_event_stream_library_init(m_allocator);
1413
}
1514

1615
std::future<RpcError> EchoTestRpcClient::Connect(
@@ -22,7 +21,7 @@ namespace Awstest
2221

2322
std::future<RpcError> EchoTestRpcClient::Close() noexcept { return m_connection.Close(); }
2423

25-
EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close().wait(); aws_event_stream_library_clean_up(); }
24+
EchoTestRpcClient::~EchoTestRpcClient() noexcept { Close().wait(); }
2625

2726
GetAllProductsOperation EchoTestRpcClient::NewGetAllProducts() noexcept
2827
{

eventstream_rpc/tests/EventStreamClientTest.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ static int s_TestEchoOperation(struct aws_allocator *allocator, void *ctx)
196196
Awstest::EchoTestRpcClient client(clientBootstrap, allocator);
197197

198198
{
199-
//aws_event_stream_library_init(allocator);
200199
auto connectedStatus = client.Connect(lifecycleHandler);
201200
ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
202201
auto echoMessage = client.NewEchoMessage();
@@ -212,7 +211,6 @@ static int s_TestEchoOperation(struct aws_allocator *allocator, void *ctx)
212211
auto response = result.GetOperationResponse();
213212
ASSERT_NOT_NULL(response);
214213
ASSERT_TRUE(response->GetMessage().value().GetStringMessage().value() == expectedMessage);
215-
//aws_event_stream_library_clean_up();
216214
}
217215
}
218216

0 commit comments

Comments
 (0)