Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work #53

Merged
merged 2 commits into from
Apr 7, 2024
Merged

Work #53

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.tidal.networktime.internal

import com.tidal.networktime.internal.network_framework_workaround.nw_connection_send_with_default_context
import com.tidal.networktime.internal.network_framework_workaround.nw_parameters_create_secure_udp_workaround
import com.tidal.networktime.internal.network_framework_workaround.nw_connection_send_default_context
import com.tidal.networktime.internal.network_framework_workaround.nw_parameters_create_secure_udp_disable_protocol
import kotlinx.cinterop.ExperimentalForeignApi
import kotlinx.cinterop.addressOf
import kotlinx.cinterop.convert
Expand Down Expand Up @@ -38,7 +38,7 @@ internal actual class NTPUDPSocketOperations {

actual suspend fun prepare(address: String, portNumber: Int, connectTimeout: Duration) {
println("BEFORE CREATESECUREUDP")
val parameters = nw_parameters_create_secure_udp_workaround()
val parameters = nw_parameters_create_secure_udp_disable_protocol()
println("BEFORE CREATEHOST")
println("Endpoint is $address/$portNumber")
val endpoint = nw_endpoint_create_host(address, portNumber.toString())
Expand Down Expand Up @@ -76,7 +76,7 @@ internal actual class NTPUDPSocketOperations {
)
}
println("BEFORE SEND")
nw_connection_send_with_default_context(
nw_connection_send_default_context(
connection,
data,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ language = Objective-C

---

#include <Network/Network.h>
#import <Network/Network.h>
#import <Network/connection.h>

// https://stackoverflow.com/a/63050804
NW_RETURNS_RETAINED nw_parameters_t nw_parameters_create_secure_udp_workaround() {
NW_RETURNS_RETAINED nw_parameters_t nw_parameters_create_secure_udp_disable_protocol() {
return nw_parameters_create_secure_udp(
NW_PARAMETERS_DISABLE_PROTOCOL,
NW_PARAMETERS_DEFAULT_CONFIGURATION
);
}

// https://youtrack.jetbrains.com/issue/KT-62102/
void nw_connection_send_with_default_context(
void nw_connection_send_default_context(
nw_connection_t connection,
_Nullable dispatch_data_t content,
bool is_complete,
Expand Down
Loading