-
Notifications
You must be signed in to change notification settings - Fork 3
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
TXT record method and safety check on netServiceDidResolveAddress() #3
base: master
Are you sure you want to change the base?
Conversation
Added a method to set the TXT record of the mDNS service to push arbitrary data alongside the discovered services. |
The two commits are not part of a common plan but being in the same branch github includes both... |
src/ofxBonjourPublisher.mm
Outdated
|
||
bool ofxBonjourPublisher::setTextRecord(std::vector<std::pair<std::string, std::string>> key_values = {}) { | ||
NSMutableDictionary * record = [NSMutableDictionary dictionary]; | ||
for (const auto & [key, value]: key_values) [record setValue:@(value.c_str()) forKey: @(key.c_str())]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a feature from C++17.
please rewrite as C++11 like:
for(const auto &kv : key_values) [record setValue:@(kv.second.c_str()) forKey: @(kv.first.c_str())];
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey! now that C++17 is OK, what about these? note a few more changes below.
Difficult to reproduce but switching network configurations can produce this odd situation (and hard crash when there is no objectAtIndex:0).