Skip to content

Commit de6eeee

Browse files
committed
Fix ip issue
1 parent ab19e31 commit de6eeee

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

Sources/OpenGraphCxx/DebugServer/DebugServer.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@
8181
uint32_t ip_data = ntohl(ifa_addr->sin_addr.s_addr);
8282
if (ip_data != INADDR_LOOPBACK) {
8383
ip = ip_data;
84+
break; // Take first non-loopback interface
8485
}
8586
}
8687
current_iaddrs = current_iaddrs->ifa_next;

Sources/OpenGraphCxx/include/OpenGraphCxx/DebugServer/DebugServer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct OGDebugServerMessageHeader {
2929

3030
class DebugServer {
3131
public:
32-
DebugServer(unsigned int port);
32+
DebugServer(OGDebugServerMode mode);
3333
~DebugServer();
3434

3535
CFURLRef _Nullable copy_url() const;

Tests/OpenGraphCompatibilityTests/Debug/DebugServerTests.swift

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ struct DebugServerTests {
2727
let _ = try #require(DebugServer.start(mode: [.valid]))
2828
let url = try #require(DebugServer.copyURL()) as URL
2929
#expect(url.scheme == "graph")
30-
#expect(url.host() == "127.0.0.1")
30+
let host = try #require(url.host())
31+
#expect(host == "127.0.0.1")
3132
DebugServer.run(timeout: 1)
3233
DebugServer.stop()
3334
}
@@ -39,14 +40,9 @@ struct DebugServerTests {
3940
let _ = try #require(DebugServer.start(mode: [.valid, .networkInterface]))
4041
let url = try #require(DebugServer.copyURL()) as URL
4142
#expect(url.scheme == "graph")
42-
#expect(url.host() != "127.0.0.1")
43-
// FIXME
44-
// OG:
45-
// print: graph://198.19.249.3:58088/?token=1502822185
46-
// url: graph://198.19.249.3:58088/?token=1502822185
47-
// AG:
48-
// print: debug server graph://192.168.8.211:49691/?token=3662216201
49-
// url: graph://192.168.8.211:49694/?token=1022379324
43+
let host = try #require(url.host())
44+
#expect(host != "127.0.0.1")
45+
#expect(host.hasPrefix("192.168"))
5046
DebugServer.run(timeout: 1)
5147
DebugServer.stop()
5248
}

0 commit comments

Comments
 (0)