Skip to content

Commit

Permalink
remove TLS slot creation for iOS as it's handled internally by nw_con…
Browse files Browse the repository at this point in the history
…nection
  • Loading branch information
sbSteveK committed Sep 18, 2024
1 parent 4aa7590 commit 4b8b2a4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
9 changes: 7 additions & 2 deletions source/channel_bootstrap.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,17 +474,22 @@ static void s_on_client_channel_on_setup_completed(struct aws_channel *channel,
goto error;
}

/* iOS uses Apple Network Framework. The TCP and TLS handshake are both handled by the
* network parameters and its options and verification block. We do not need to set up a
* separate TLS slot in the channel for iOS. */
#if !defined(AWS_OS_IOS)
if (connection_args->channel_data.use_tls) {
/* we don't want to notify the user that the channel is ready yet, since tls is still negotiating, wait
* for the negotiation callback and handle it then.*/
if (s_setup_client_tls(connection_args, channel)) {
err_code = aws_last_error();
goto error;
}
} else {
s_connection_args_setup_callback(connection_args, AWS_OP_SUCCESS, channel);
return;
}
#endif /* !AWS_OS_IOS */

s_connection_args_setup_callback(connection_args, AWS_OP_SUCCESS, channel);
return;
}

Expand Down
8 changes: 0 additions & 8 deletions source/darwin/darwin_pki_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,14 +446,6 @@ int aws_secitem_import_trusted_certificates(
goto done;
}

// Redone with conversion to DER format above
// cert_data = CFDataCreate(cf_alloc, certificates_blob->ptr, certificates_blob->len);
// if (!cert_data) {
// AWS_LOGF_ERROR(AWS_LS_IO_PKI, "Error creating root ca data system call.");
// result = aws_raise_error(AWS_ERROR_SYS_CALL_FAILURE);
// goto done;
// }

certificate_ref = SecCertificateCreateWithData(cf_alloc, cert_data);
if (!certificate_ref) {
AWS_LOGF_ERROR(AWS_LS_IO_PKI, "Failed creating root ca SecCertificateRef from cert_data.");
Expand Down
13 changes: 7 additions & 6 deletions source/darwin/nw_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,7 +1279,7 @@ static int s_socket_write_fn(

dispatch_data_t data = dispatch_data_create(cursor->ptr, cursor->len, NULL, DISPATCH_DATA_DESTRUCTOR_FREE);

printf("\nWriting to SOCKET\n\n");
printf("\nWriting %zu to SOCKET\n\n", cursor->len);
nw_connection_send(
handle, data, _nw_content_context_default_message, true, ^(nw_error_t error) {
AWS_LOGF_TRACE(
Expand All @@ -1298,11 +1298,12 @@ static int s_socket_write_fn(
goto nw_socket_release;
}

AWS_LOGF_ERROR(
AWS_LS_IO_SOCKET,
"id=%p handle=%p: DEBUG:: callback writing message: %p",
(void *)socket,
handle, user_data);
if (error != NULL) {
printf("\nError sending data. error code:%d\n\n", nw_error_get_error_code(error));
} else {
printf("\nData sent successfully\n\n");
}

int error_code = !error || nw_error_get_error_code(error) == 0
? AWS_OP_SUCCESS
: s_determine_socket_error(nw_error_get_error_code(error));
Expand Down

0 comments on commit 4b8b2a4

Please sign in to comment.