Branch: Tag:

2005-01-26

2005-01-26 21:48:48 by Martin Stjernholm <mast@lysator.liu.se>

Propagate return values from callbacks properly. Better typing of the
callbacks. Cleaned up the set_peek_file_before_read_callback kludge
which isn't necessary any more. Handle if the backend can't tell
normal and oob read events apart. Some more fixes in the callback doc.

Rev: lib/modules/Stdio.pmod/module.pmod:1.210

1243:   </li><li><p>When the stream has buffer space over for writing, <code>write_cb</code>    will be called so that you can write more data to it.</p>   <p> This callback is also called after the remote end of a socket -  connection has closed the write direction only. An attempt to -  write data to it in that case will generate a <code>System.EPIPE</code> -  errno.</p> +  connection has closed the write direction. An attempt to write +  data to it in that case will generate a <code>System.EPIPE</code> errno. +  If the remote end has closed both directions simultaneously +  (the usual case), Pike will first attempt to call <code>close_cb</code>, +  then this callback (unless <code>close_cb</code> has closed the stream).</p>   </li><li><p>When out-of-band data arrives on the stream, <code>read_oob_cb</code>    will be called with some or all of that data as the second    argument.</p>
1256:    out-of-band data, Pike will try to call <code>write_oob_cb</code> first.    If it doesn't write anything, then <code>write_cb</code> will be tried.    This also means that <code>write_oob_cb</code> might get called when the -  remote end of a connection has closed the write direction -  only.</p> +  remote end of a connection has closed the write direction.</p>   </li><li><p>When an error or an end-of-stream in the read direction    occurs, <code>close_cb</code> will be called. <code>errno</code> will return the    error, or zero in the case of an end-of-stream.</p>
1269:    allocated). Also, this callback will not be called for a local    close, neither by a call to <code>close</code> or by destructing this    object.</p> - <p> Also, <code>close_cb</code> will not be called if a remote close occurs -  in the write direction; that is handled by <code>write_cb</code> (or -  possibly <code>write_oob_cb</code>).</p> - <p> If an error occurs, all events will be automatically -  deregistered, so there won't be any more read or write events -  unless callbacks are reinstalled. This doesn't affect the + <p> Also, <code>close_cb</code> will not be called if a remote close only +  occurs in the write direction; that is handled by <code>write_cb</code> +  (or possibly <code>write_oob_cb</code>).</p> + <p> Events to <code>read_cb</code> and <code>close_cb</code> will be automatically +  deregistered if an end-of-stream occurs, and all events in the +  case of an error. I.e. there won't be any more calls to the +  callbacks unless they are reinstalled. This doesn't affect the    callback settings - <code>query_read_callback</code> et al will still    return the installed callbacks.</p> - </li></ul><p>All callbacks will receive the <tt>id</tt> set by <code>set_id</code> as + </li></ul><p>If the stream is a socket performing a nonblocking connect (see +  <code>open_socket</code> and <code>connect</code>), a connection failure will call +  <code>close_cb</code>, and a successful connect will call either +  <code>read_cb</code> or <code>write_cb</code> as above.</p> + <p> All callbacks will receive the <tt>id</tt> set by <code>set_id</code> as    first argument.</p>   <p> If a callback returns <code class='expr'>-1</code>, no other callback or call out    will be called by the backend in that round. I.e. the caller of