EldoS | Feel safer!

Software components for data protection, secure storage and transfer

wait before read issues

Posted: 10/15/2008 17:07:37
by adam  (Basic support level)
Joined: 03/13/2008
Posts: 18

Using the Mapper sample i have implemented a network drive. onEnumerateDirectory() retrieves from the server a list of files and attributes i then pass this information to CBFS. onOpenFile() i download the file if it's not cached already. onReadFile() reads the cached file on the local machine. The problem i have is explorer will "freeze" while a file is downloaded.

I am interested in how CBFS developers have overcome the issue of explorer "freezing" while CBFS waits for a file to be downloaded in events onReadFile(), onOpenFile()?

Thanks in Advance
Posted: 10/15/2008 22:56:11
by Eugene Mayevski (Team)

The only way to get rid of delays when processing read operations is to read the file and cache it when it's handle is opened. There's no other way to solve the problem. With writing the situation is easier - you can write the files asynchronously, by implementing a queue of pending write operations in your application and having one or several worker threads process the queue.

Sincerely yours
Eugene Mayevski
Posted: 10/16/2008 03:21:51
by adam  (Basic support level)
Joined: 03/13/2008
Posts: 18

Do you mean when the handle is opened in onOpenFile() ?

For example...

If( isFileCached(fileName) )
Cbfs.resetTimeout( 0 );
DownloadFile() //blocks until file is downloaded
OpenFileHandle( localCacheDir + FileName );


The above is how I have implemented my cbfs networkdrive. Works great but explorer will hang while a file is downloaded in event onOpenFile()
Posted: 10/16/2008 04:15:01
by Volodymyr Zinin (Team)

As for me a better way is to start downloading (caching) a file at the time it's being opened using some another thread and immediately finish the OnOpen request. I.e. download the file asynchronously. So there is a possibility that the file has been downloaded successfully until the OnRead request is called and it won't necessary to wait at all (but if a requested part has not been downloaded yet then wait in the OnRead request until the thread, that is downloading the file, obtains this file part).



Topic viewed 5301 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!