TOSMBClient icon indicating copy to clipboard operation
TOSMBClient copied to clipboard

requestContentsOfDirectoryAtFilePath: returns nil and only works after a few minutes

Open flysofast opened this issue 8 years ago • 0 comments

Hi, I've been playing with this project for a while and noticed that (NSArray *)requestContentsOfDirectoryAtFilePath:(NSString *)path error:(NSError **)error worked well most of the time, the only it has a small problem is when the selected share was my computer (the computer that deployed the app, the others on the same LAN work fine), I had to wait for a few minutes before it could return the contents of the root folder (otherwise it would return nil). This seems to be a little strange, I tried to track down and found out the problem was in this section

- (NSArray *)requestContentsOfDirectoryAtFilePath:(NSString *)path error:(NSError **)error
{
    ...
    //If the path is nil, or '/', we'll be specifically requesting the
    //parent network share names as opposed to the actual file lists

    if (path.length == 0 || [path isEqualToString:@"/"]) {
        smb_share_list list;
        size_t shareCount = 0;
        smb_share_get_list(self.session, &list, &shareCount);
        if (shareCount == 0)
            return nil;
....
     }
}

smb_share_get_list(self.session, &list, &shareCount); was using the same self.session object but returns different results after sometime. It returned 0 at first, then after a while it returned the real contents of the root folder. I know this question is somewhat related to libdsm but maybe I'm missing something here. Do you see what is wrong here, or have any of you have this issue? Thank you.

Hardware / Software

I'm using the library with commit 85ff45f (Dec 4, 2016 3:19PM) iOS 10.3 beta, iPhone 6 macOS 10.12.3, macbook pro 15" late 2013

Expected Results

I want the app to display the contents of my computer's root folder right away when I sign in and access the share.

Actual Results

It's blank at first, then after some time the contents appeared after being reloaded.

flysofast avatar Feb 18 '17 04:02 flysofast