emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Non-blocking open-network-stream


From: Helmut Eller
Subject: Re: Non-blocking open-network-stream
Date: 26 Feb 2002 23:46:32 +0100

address@hidden (Kim F. Storm) writes:

> Here is my second attempt at a patch to support non-blocking
> open-network-stream.

I think the problem I described last time is still present.  The
problem is that the filter is invoked before the sentinel.  This
happens when the stream is readable immediately after the transition
from connect state to open state.

Consider wait_reading_process_input:

> --- 3001,3047 ----
[...]
> +           XSETINT (p->tick, ++process_tick);
> +           if (getpeername(channel, &pname, &pnamelen) < 0)
[...]
> +           else
> +             {
> +               p->status = Qrun;

Tick is incremented and status is set to Qrun.  Incrementing tick
causes status_notify to be invoked during the next iteration.

But status_notify ...

> --- 4624,4630 ----
[...]
>         while (! EQ (p->filter, Qt)
> +              && ! EQ (p->status, Qconnect)
>                && XINT (p->infd) >= 0
>                && read_process_output (proc, XINT (p->infd)) > 0);

... calls read_process_output (and the filter) before the sentinel.

A simple solution is to call the sentinel in
wait_reading_process_input without incrementing tick, e.g.:

--- 3001,3047 ----
...       
+             if (getpeername(channel, &pname, &pnamelen) < 0)
+                 XSETINT (p->tick, ++process_tick);
...           
+             else
+               {
+                 p->status = Qrun;
+                 exec_sentinel (proc, Qopen);
            
Another point: is it a problem to pass the error message and not just
the error number to the sentinel?  

Helmut.










reply via email to

[Prev in Thread] Current Thread [Next in Thread]