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

Revert changes to fix console logging issue #56

Open
wants to merge 4 commits into
base: 0.46-canary
Choose a base branch
from
Open
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
81 changes: 0 additions & 81 deletions Libraries/WebSocket/RCTReconnectingWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -12,71 +12,10 @@
#import <React/RCTConvert.h>
#import <React/RCTDefines.h>

#if __has_include(<React/fishhook.h>)
#import <React/fishhook.h>
#else
#import <fishhook/fishhook.h>
#endif
#if __has_include(<os/log.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */
#import <os/log.h>
#endif /* __IPHONE_10_3 */

#import "RCTSRWebSocket.h"

#if RCT_DEV // Only supported in dev mode

#if __has_include(<os/log.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */

// From https://github.com/apple/swift/blob/ad40c770bfe372f879b530443a3d94761fe258a6/stdlib/public/SDK/os/os_log.m
typedef struct os_log_pack_s {
uint64_t olp_continuous_time;
struct timespec olp_wall_time;
const void *olp_mh;
const void *olp_pc;
const char *olp_format;
uint8_t olp_data[0];
} os_log_pack_s, *os_log_pack_t;

static void (*orig__nwlog_pack)(os_log_pack_t pack, os_log_type_t logType);

static void my__nwlog_pack(os_log_pack_t pack, os_log_type_t logType)
{
if (logType == OS_LOG_TYPE_ERROR && strstr(pack->olp_format, "Connection has no connected handler") == NULL) {
orig__nwlog_pack(pack, logType);
}
}

#endif /* __IPHONE_10_3 */

static void (*orig_nwlog_legacy_v)(int, char*, va_list);

static void my_nwlog_legacy_v(int level, char *format, va_list args) {
static const uint buffer_size = 256;
static char buffer[buffer_size];
va_list copy;
va_copy(copy, args);
vsnprintf(buffer, buffer_size, format, copy);
va_end(copy);

if (strstr(buffer, "nw_connection_get_connected_socket_block_invoke") == NULL &&
strstr(buffer, "Connection has no connected handler") == NULL) {
orig_nwlog_legacy_v(level, format, args);
}
}

#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */

static void (*orig_os_log_error_impl)(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size);

static void my_os_log_error_impl(void *dso, os_log_t log, os_log_type_t type, const char *format, uint8_t *buf, uint32_t size)
{
if (strstr(format, "TCP Conn %p Failed : error %ld:%d") == NULL) {
orig_os_log_error_impl(dso, log, type, format, buf, size);
}
}

#endif /* __IPHONE_11_0 */

@interface RCTReconnectingWebSocket () <RCTSRWebSocketDelegate>
@end

Expand All @@ -87,26 +26,6 @@ @implementation RCTReconnectingWebSocket {

@synthesize delegate = _delegate;

+ (void)load
{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
rebind_symbols((struct rebinding[1]){
{"nwlog_legacy_v", my_nwlog_legacy_v, (void *)&orig_nwlog_legacy_v}
}, 1);
#if __has_include(<os/log.h>) && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 100300 /* __IPHONE_10_3 */
rebind_symbols((struct rebinding[1]){
{"__nwlog_pack", my__nwlog_pack, (void *)&orig__nwlog_pack}
}, 1);
#endif /* __IPHONE_10_3 */
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */
rebind_symbols((struct rebinding[1]){
{"_os_log_error_impl", my_os_log_error_impl, (void *)&orig_os_log_error_impl}
}, 1);
#endif /* __IPHONE_11_0 */
});
}

- (instancetype)initWithURL:(NSURL *)url
{
if (self = [super init]) {
Expand Down
23 changes: 0 additions & 23 deletions Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
/* Begin PBXBuildFile section */
1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13526A511F362F7F0008EF00 /* libfishhook.a */; };
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; };
Expand All @@ -25,7 +24,6 @@
1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTSRWebSocket.m; sourceTree = "<group>"; };
1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketExecutor.h; sourceTree = "<group>"; };
1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketExecutor.m; sourceTree = "<group>"; };
13526A511F362F7F0008EF00 /* libfishhook.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libfishhook.a; path = "libfishhook.a"; sourceTree = "<group>"; };
2D2A28881D9B049200D4039D /* libRCTWebSocket-tvOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libRCTWebSocket-tvOS.a"; sourceTree = BUILT_PRODUCTS_DIR; };
3C86DF461ADF2C930047B81A /* libRCTWebSocket.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTWebSocket.a; sourceTree = BUILT_PRODUCTS_DIR; };
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketModule.h; sourceTree = "<group>"; };
Expand All @@ -36,26 +34,7 @@
A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReconnectingWebSocket.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
13526A4F1F362F770008EF00 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
13526A501F362F7F0008EF00 /* Frameworks */ = {
isa = PBXGroup;
children = (
13526A511F362F7F0008EF00 /* libfishhook.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
3C86DF3D1ADF2C930047B81A = {
isa = PBXGroup;
children = (
Expand All @@ -70,7 +49,6 @@
3C86DF7A1ADF695F0047B81A /* RCTWebSocketModule.h */,
3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */,
3C86DF471ADF2C930047B81A /* Products */,
13526A501F362F7F0008EF00 /* Frameworks */,
);
indentWidth = 2;
sourceTree = "<group>";
Expand Down Expand Up @@ -108,7 +86,6 @@
buildConfigurationList = 3C86DF5A1ADF2C930047B81A /* Build configuration list for PBXNativeTarget "RCTWebSocket" */;
buildPhases = (
3C86DF421ADF2C930047B81A /* Sources */,
13526A4F1F362F770008EF00 /* Frameworks */,
);
buildRules = (
);
Expand Down
22 changes: 0 additions & 22 deletions Libraries/fishhook/LICENSE

This file was deleted.

75 changes: 0 additions & 75 deletions Libraries/fishhook/README.md

This file was deleted.

Loading