From 7340b1d6e3c9de607608a786b839001500a3348b Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 21:37:47 +0000 Subject: Fix hanging UI when `null` addr --- src/libui_sdl/LAN_PCap.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index c228f5e..55b0891 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,12 +257,11 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName)) + if (strcmp(curaddr->ifa_name, adata->DeviceName) || !curaddr->ifa_addr) { curaddr = curaddr->ifa_next; continue; } - if (!curaddr->ifa_addr) continue; u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET) -- cgit v1.2.3 From 7e07250652260657b0a78d66c556d6edc1175b27 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:19:30 +0000 Subject: Maybe better to log --- src/libui_sdl/LAN_PCap.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 55b0891..0682e61 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,12 +257,18 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName) || !curaddr->ifa_addr) + if (strcmp(curaddr->ifa_name, adata->DeviceName) { curaddr = curaddr->ifa_next; continue; } + if (!curaddr->ifa_addr){ + printf("Device does not have an address :/"); + curaddr = curaddr->ifa_next; + continue; + } + u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET) { -- cgit v1.2.3 From cdd60bb29822736bc7e0a0a3469e1aed33052e00 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:20:39 +0000 Subject: fix build --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 0682e61..e407866 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -257,7 +257,7 @@ bool Init(bool open_adapter) struct ifaddrs* curaddr = addrs; while (curaddr) { - if (strcmp(curaddr->ifa_name, adata->DeviceName) + if (strcmp(curaddr->ifa_name, adata->DeviceName)) { curaddr = curaddr->ifa_next; continue; -- cgit v1.2.3 From c2a55bc2174daea687f865089af4e7a3fdc192f3 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:22:47 +0000 Subject: clean log --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index e407866..dd5a700 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -264,7 +264,7 @@ bool Init(bool open_adapter) } if (!curaddr->ifa_addr){ - printf("Device does not have an address :/"); + printf("Device does not have an address :/\n"); curaddr = curaddr->ifa_next; continue; } -- cgit v1.2.3 From 477be1d1551fdd4925c95404b5af025ed9f30081 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Tue, 19 Nov 2019 22:34:02 +0000 Subject: add device name --- src/libui_sdl/LAN_PCap.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index dd5a700..75a2e3c 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -264,7 +264,7 @@ bool Init(bool open_adapter) } if (!curaddr->ifa_addr){ - printf("Device does not have an address :/\n"); + printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); curaddr = curaddr->ifa_next; continue; } -- cgit v1.2.3 From 7730e6c1e2086db4c73ecebaa140ca45c1383a9f Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Wed, 20 Nov 2019 23:24:16 +0000 Subject: Coding style + weird spacing --- src/libui_sdl/LAN_PCap.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 75a2e3c..312af0e 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -263,10 +263,11 @@ bool Init(bool open_adapter) continue; } - if (!curaddr->ifa_addr){ + if (!curaddr->ifa_addr) + { printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); curaddr = curaddr->ifa_next; - continue; + continue; } u16 af = curaddr->ifa_addr->sa_family; -- cgit v1.2.3 From 295404a5a696c158df2ddf9b9548c0a4b8c368c6 Mon Sep 17 00:00:00 2001 From: i404788 <50617709+i404788@users.noreply.github.com> Date: Thu, 12 Dec 2019 09:03:01 +0000 Subject: Fix weird spacing --- src/libui_sdl/LAN_PCap.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/libui_sdl/LAN_PCap.cpp b/src/libui_sdl/LAN_PCap.cpp index 312af0e..44af0a3 100644 --- a/src/libui_sdl/LAN_PCap.cpp +++ b/src/libui_sdl/LAN_PCap.cpp @@ -263,12 +263,12 @@ bool Init(bool open_adapter) continue; } - if (!curaddr->ifa_addr) - { - printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); - curaddr = curaddr->ifa_next; - continue; - } + if (!curaddr->ifa_addr) + { + printf("Device (%s) does not have an address :/\n", curaddr->ifa_name); + curaddr = curaddr->ifa_next; + continue; + } u16 af = curaddr->ifa_addr->sa_family; if (af == AF_INET) -- cgit v1.2.3