# SERVER: read(conn,1) is a pickpocket

Alex Stewart (riche@crl.com)
Sat, 21 Oct 1995 03:04:18 PDT

- Messages sorted by:[ date ][ thread ][ subject ][ author ]

    (or should I say "picksocket".. anyway..)

    I was just looking over some of the 1.7.9 server code, and noticed something
    which I thought I'd bring up..

    It appears (and I've tested this too), that using non-suspending-reads
    (read(conn, 1)) on a network connection under the right conditions can
    actually steal input from a currently (suspended) reading task on that
    connection.  Old-style read calls when used on a connection which was already
    being read from would throw E_INVARG, but the non-suspending read stuff
    apparently doesn't check for this condition.

    I'm trying to decide whether this is actually a good thing or a bad thing,
    actually, but my inclination is that it's probably a bad thing, as it
    introduces some potential unpredictabilities into the issue of net IO..  I
    thought I'd ask what other people thought, tho, before putting together a
    patch for it (which would be fairly minor)..

    -R
    -------------------------------------------------------------------------------
         Alex Stewart - riche@crl.com - Richelieu @ Diversity University MOO
                             http://www.crl.com/~riche/
                "Difficult answers lead to intelligent questions."