Skip to content

Conversation

@ABeltramo
Copy link

First off, thanks for this brilliant library!

A user recently introduced this library into my open source project wolf and everything seems to be working, expect for when it doesn't 😅

A user reported the following exception:

mDNS: Local IPv4 address: 192.168.178.25
mDNS: Local IPv6 address: fd30:854e:2d95:0:e9d:92ff:fe84:f3a9
mDNS: Error: Failed to open any client sockets

I'm not sure what's causing it (any help in debugging that?) but when you throw from your thread I have no way to catch those exceptions from the main thread.
So I've added a simple bool flag to avoid starting that thread automatically and instead do something like:

  std::thread([]() {
    logs::log(logs::info, "Starting mDNS service");
    try {
      // ...
      mdns.startService(false);
    } catch (const std::exception &e) {
      logs::log(logs::error, "mDNS error: {}", e.what());
    }
  }).detach();

To avoid crashing the main application when that fails.

Let me know what you think!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant