From eb1e3eede74b016ae8e142b5ee2af28c6edeff4b Mon Sep 17 00:00:00 2001 From: Martin Schaefer Date: Fri, 10 Nov 2017 16:13:18 +0100 Subject: [PATCH] Fixed addition/removal of devices during discovery (thanks @leolobato). --- .../UserInterfaceState.xcuserstate | Bin 43814 -> 43814 bytes SMBClient/SMBDiscovery.m | 16 ++++++++-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/SMBClient.xcodeproj/project.xcworkspace/xcuserdata/masc.xcuserdatad/UserInterfaceState.xcuserstate b/SMBClient.xcodeproj/project.xcworkspace/xcuserdata/masc.xcuserdatad/UserInterfaceState.xcuserstate index b95cd29563fdf6918e38d7ac2c19f58354beff94..e3fd78c019b3b0539e7e3e78ed7e9ba21bf4662b 100644 GIT binary patch delta 176 zcmZ2>jcM66rVTxejGs35GESD3e#H2g@d@Ko#%GL=7@svPZdlT=ykSMdN+4_H<_)5( zjEVxBml-%2xEQz@KQn$~5L(3WfbnaCW5d!#438OqG&nabn;b8vz*xPxNscp1?h)r@ zWYZd%z9EcjaNFEy&dfO3L5_X$=1vh-u;$HYI_L6jcM66rVTxej6XN`GESD3W@UWL_=NE(<1e>=wQfGsIhRk=S1w2{L@rD&S}s;DUM^9tK(1J>W^>() G6+!^z=0b4* diff --git a/SMBClient/SMBDiscovery.m b/SMBClient/SMBDiscovery.m index d373959..cd50d5d 100644 --- a/SMBClient/SMBDiscovery.m +++ b/SMBClient/SMBDiscovery.m @@ -114,27 +114,27 @@ - (void)stopDiscovery { } static void _on_entry_added(void *p_opaque, netbios_ns_entry *entry) { - if (_addedHandler) { - dispatch_async(dispatch_get_main_queue(), ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (_addedHandler) { SMBDevice *device = _device(entry); if (_typeMask & device.type) { _addedHandler(_device(entry)); } - }); - } + } + }); } static void _on_entry_removed(void *p_opaque, netbios_ns_entry *entry) { - if (_removedHandler) { - dispatch_async(dispatch_get_main_queue(), ^{ + dispatch_async(dispatch_get_main_queue(), ^{ + if (_removedHandler) { SMBDevice *device = _device(entry); if (_typeMask & device.type) { _removedHandler(_device(entry)); } - }); - } + } + }); } @end