Skip to content

Commit afe0f9e

Browse files
committed
Update code gen interface for connect
1 parent bfa6c1a commit afe0f9e

File tree

6 files changed

+21
-7
lines changed

6 files changed

+21
-7
lines changed

eventstreamrpc/source/EventStreamClient.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,7 @@ namespace Aws
253253

254254
bool ConnectionLifecycleHandler::OnErrorCallback(int errorCode)
255255
{
256+
(void) errorCode;
256257
/* Returning true implies that the connection will close upon receiving an error. */
257258
return true;
258259
}

ipc/include/aws/greengrass/GreengrassCoreIpcClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Aws
2828
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept;
2929
std::future<RpcError> Connect(
3030
ConnectionLifecycleHandler &lifecycleHandler,
31-
const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept;
31+
ConnectionConfig connectionConfig = DefaultConnectionConfig()) noexcept;
3232
void Close() noexcept;
3333
SubscribeToIoTCoreOperation NewSubscribeToIoTCore(SubscribeToIoTCoreStreamHandler &) noexcept;
3434
PublishToIoTCoreOperation NewPublishToIoTCore() noexcept;

ipc/source/GreengrassCoreIpcClient.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,14 @@ namespace Aws
3838

3939
std::future<RpcError> GreengrassCoreIpcClient::Connect(
4040
ConnectionLifecycleHandler &lifecycleHandler,
41-
const ConnectionConfig& connectionConfig) noexcept
41+
ConnectionConfig connectionConfig) noexcept
4242
{
43+
/* If a client bootstrap has not been set in the config, use the one from the client. */
44+
if (connectionConfig.GetClientBootstrap() == nullptr)
45+
{
46+
connectionConfig.SetClientBootstrap(&m_clientBootstrap);
47+
}
48+
4349
return m_connection.Connect(
4450
connectionConfig, &lifecycleHandler, connectionConfig.GetConnectMessageAmender(), m_clientBootstrap);
4551
}

ipc/tests/EchoClientTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ static int s_connectToServer(struct aws_allocator *allocator, void *ctx)
4040

4141
ConnectionLifecycleHandler lifecycleHandler;
4242
Awstest::EchoTestRpcClient client(clientBootstrap);
43-
// auto connectedStatus = client.Connect(lifecycleHandler);
44-
// ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
43+
auto connectedStatus = client.Connect(lifecycleHandler);
44+
ASSERT_TRUE(connectedStatus.get().baseStatus == EVENT_STREAM_RPC_SUCCESS);
4545

4646
client.Close();
4747
}

ipc/tests/EchoTestRpcClient.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,16 @@ namespace Awstest
1414

1515
std::future<RpcError> EchoTestRpcClient::Connect(
1616
ConnectionLifecycleHandler &lifecycleHandler,
17-
const ConnectionConfig &connectionConfig) noexcept
17+
ConnectionConfig connectionConfig) noexcept
1818
{
19-
return m_connection.Connect(connectionConfig, &lifecycleHandler, connectionConfig.GetConnectMessageAmender(), m_clientBootstrap);
19+
/* If a client bootstrap has not been set in the config, use the one from the client. */
20+
if (connectionConfig.GetClientBootstrap() == nullptr)
21+
{
22+
connectionConfig.SetClientBootstrap(&m_clientBootstrap);
23+
}
24+
25+
return m_connection.Connect(
26+
connectionConfig, &lifecycleHandler, connectionConfig.GetConnectMessageAmender(), m_clientBootstrap);
2027
}
2128

2229
void EchoTestRpcClient::Close() noexcept { m_connection.Close(); }

ipc/tests/include/awstest/EchoTestRpcClient.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace Awstest
2626
Aws::Crt::Allocator *allocator = Aws::Crt::g_allocator) noexcept;
2727
std::future<RpcError> Connect(
2828
ConnectionLifecycleHandler &lifecycleHandler,
29-
const ConnectionConfig &connectionConfig = DefaultConnectionConfig()) noexcept;
29+
ConnectionConfig connectionConfig = DefaultConnectionConfig()) noexcept;
3030
void Close() noexcept;
3131
GetAllProductsOperation NewGetAllProducts() noexcept;
3232
CauseServiceErrorOperation NewCauseServiceError() noexcept;

0 commit comments

Comments
 (0)