Skip to content

Commit

Permalink
fix(Endpoint): End the process via exit function
Browse files Browse the repository at this point in the history
The app can be exited by the exit function call. The exit status
can also be caught by the buildkite more easily than the log.
  • Loading branch information
splasky committed Aug 12, 2020
1 parent b092a0a commit fe7ba1d
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions endpoint/endpointComp/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,16 @@ COMPONENT_INIT {
device_t* device = ta_device(STRINGIZE(EP_TARGET));
if (device == NULL) {
LE_ERROR("Can not get specific device");
} else {
device->op->get_key(private_key);
device->op->get_device_id(device_id);
#ifdef ENABLE_ENDPOINT_TEST
LE_TEST_INIT;
LE_TEST_INFO("=== ENDPOINT TEST BEGIN ===");
LE_TEST(SC_OK == send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv));
LE_TEST_EXIT;
#else
while (true) {
// TODO: listen input from UART here
status_t ret = send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address,
next_address, private_key, device_id_ptr, iv);
LE_INFO("Send transaction information return: %d", ret);
sleep(10);
}
#endif
exit(EXIT_FAILURE);
}

device->op->get_key(private_key);
device->op->get_device_id(device_id);

status_t ret = SC_OK;
LE_INFO("=== ENDPOINT TEST BEGIN ===");
ret = send_transaction_information(host, port, ssl_seed, value, message, message_fmt, tag, address, next_address,
private_key, device_id_ptr, iv);
LE_INFO("Send transaction information return: %d", ret);
exit(ret == SC_OK ? EXIT_SUCCESS : EXIT_FAILURE);
}

0 comments on commit fe7ba1d

Please sign in to comment.