socket inputs handled in reverse order?



We have a PyGTK application at work that uses gobject signals and the
gobject/gtk main loop to process event input and simultaneously listen for
data arriving on a socket.  A homegrown low-level C++ library calls
g_io_add_watch_full with G_PRIORITY_HIGH_IDLE on the channel associated with
the socket.

Most of the time everything works fine.  Input arrives at the handler and is
then distributed to all interested parties via a gobject emit() call.
Sometimes though, we can see that a burst of inputs are processed in reverse
order.  In our low level handler we print out the information received.  It
might print

    1
    2
    3
    4
    5

In one of the client routines we display the same information and see it
printed in reverse order:

    5
    4
    3
    2
    1

Is it possible the signal emission for packet #1 is interrupted by more
input waiting on the socket?  If so, what can we do to insure processing of
one packet is complete before the next packet is processed?

Thanks,

-- 
Skip Montanaro
Katrina Benefit Concerts: http://www.musi-cal.com/katrina
skip pobox com



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