On 14/10/2010 05:44, Chris Frey wrote: > On Mon, Oct 11, 2010 at 10:50:38AM +0100, Toby Gray wrote: ... > > Oops, I meant DefaultRead(). We still set seen_error in DoRead(), > I've added the check back to DefaultRead(), which I think you said > was needed for recovering from errors... possibly in Close? > > My memory is fuzzy on this. If you notice something that still needs > repair, please send me a patch, or let me know. > Ah ok. Yes, I think the check in DefaultRead is still needed. Otherwise when a USB error is seen and the socket attempts to close you end up in a situation where: 1) The thread calling DoRead will never add any data to the queues as it doesn't perform bulk reads while the USB error value is set. 2) The thread which is closing the socket gets blocked while waiting to read the reply to the socket close message (via SocketZero::Close calling SocketZero::RawReceive calling SocketRoutingQueue::DefaultRead). As the default queue will never have anything added to it this never returns.
An alternative might be to use a timeout when performing the receives in Socket::Close. However my thinking was that as there is no chance of receiving any data, it seems a bit pointless to make the user wait. Although writing this now has made me wonder if we should just add a timeout to the receives in Socket::Close anyway. If a SocketRoutingQueue isn't being used then this doesn't appear to be an issue as then the default USB read timeout specified by m_timeout is used in Device::BulkRead, so the close will timeout eventually. Regards, Toby ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Barry-devel mailing list Barry-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/barry-devel