-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workaround for Network Framework param misinterpretation bug
- Loading branch information
Showing
4 changed files
with
73 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
library/src/nativeInterop/cinterop/NetworkFrameworkWorkaround.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package = com.tidal.networktime.internal.network_framework_workaround | ||
language = Objective-C | ||
|
||
--- | ||
|
||
#include <Network/Network.h> | ||
#import <Network/connection.h> | ||
|
||
// https://stackoverflow.com/a/63050804 | ||
NW_RETURNS_RETAINED nw_parameters_t nw_parameters_create_secure_udp_workaround() { | ||
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( | ||
nw_connection_t connection, | ||
_Nullable dispatch_data_t content, | ||
bool is_complete, | ||
nw_connection_send_completion_t completion | ||
) { | ||
nw_connection_send( | ||
connection, | ||
content, | ||
NW_CONNECTION_DEFAULT_MESSAGE_CONTEXT, | ||
is_complete, | ||
completion | ||
); | ||
} |