Skip to content
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
18 changes: 17 additions & 1 deletion src/mvrxchange/CMVRxchangeService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ void CMVRxchangeServiceImpl::mDNS_Client_Task()
result.emplace_back();
ConnectToLocalServiceArgs& localServ = result.back();

localServ.Service = r.canonical_hostname.c_str();
TXString cannonicalName = this->FilterCannonicalName( r.canonical_hostname );

localServ.Service = cannonicalName.GetStdString().c_str();

for(auto& ip : r.ipV4_address)
{
Expand Down Expand Up @@ -617,3 +619,17 @@ void CMVRxchangeServiceImpl::mDNS_Client_Task()
}

}

TXString CMVRxchangeServiceImpl::FilterCannonicalName( const TXString& name ) const
{
TXString serviceAsString = MVRXChange_Service; // e.g. "_mvrxchange._tcp"
ptrdiff_t servicePos = name.Find(serviceAsString);
if (servicePos == std::string::npos)
return "";

ptrdiff_t dotBeforeGroup = name.ReverseFind('.', servicePos - 2);
if (dotBeforeGroup == std::string::npos)
dotBeforeGroup = -1;

return name.Mid(dotBeforeGroup + 1);
}
2 changes: 2 additions & 0 deletions src/mvrxchange/CMVRxchangeService.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ namespace VectorworksMVR
void mDNS_Client_Stop();
void mDNS_Client_Start();

TXString FilterCannonicalName( const TXString& name ) const;



std::vector<std::unique_ptr<mdns_cpp::mDNS>> fmdns;
Expand Down