Re: HTLocal bug?

Sam, 
please let me give the more description about my patch.

Sam Couter <sam@topic.com.au> wrote:
> HTFileOpen() calls this:
> HTHost_setChannel(host, HTChannel_new(sockfd, NULL, YES));
> 
> Is that supposed to be called? If the "localhost" host object already has a
> channel from a previous file open, doesn't it get lost?

As you said, 
HostEvet() eventually calls HTFileOpen(), and HTFileOpen() calls
HTHost_setChannel(). Then HTHost_setChannel() set the new socket
to the "localhost" host object whether it has already had a channel
for a previous file or not. 

I think if there is a file already opened, a new file request
should be postponed until the previous one is done.  
Actually, HTCache.c seems to do this.
When HTHost_addNet() returns HT_PENDING, i.e. there is a previous
request, the new net object for that file is added to the list host->pending. 
In this case, the file should not be opened yet. 

If FileEvent() returns here(as in my patch), the previous file open
eventually finishes and calls FileEvent() with HTEvent_CLOSE, then
 1. FileEvent() calls FileCleanup(),
 2. FileCleanup() calls HTNet_delete(), 
 3. HTNet_delete() calls unregister_net(),
 4. unregister_net() calls check_pending(),
 5. check_pending() calls HTHost_launchPending(), and
 6. HTHost_launchPending() launches the postponed request
    in the host->pending.

So eventually the postponed file request will be launched.

If select() freezes in your code, I think there may be another reason...

Hmm... I'm doing mistake something?

--
kinuko

Received on Monday, 14 February 2000 05:15:46 UTC