<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 1, 2014 at 1:44 PM, Zachary Turner <span dir="ltr"><<a href="mailto:zturner@google.com" target="_blank">zturner@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>I was thinking about splitting CFD into multiple classes, one for each type of descriptor.  A FileConnection, PipeConnection, TcpSocketConnection, ListeningConnection, etc.  Then, the caller would have to instantiate the right kind.  This has its own set of problems, but at least seems to solve the problem of requiring the creator of the CFD to specify what they're actually giving us.  On posix in cases where it's user specified or don't know, it seems we could just create a FileConnection and that would be equivalent to the current behavior, since it seems to treat everything the same anyway.</div></div></blockquote><div><br></div><div>The more I think about this, the more I feel like it's the right approach (it might even be the only approach that even works, I can't really come up with anything else that solves the problem, much less does it nicely).  We've already got cases where people create a ConnectionFileDescriptor of a specific type, and use it in a way that would break if it weren't of that type.  Separating out the cases into different classes this way would allow these cases to be cleaner, as many methods that are publicly exposed on CFD, and some of the class members as well are specific to the type of fd being wrapped.  So the interfaces of the other types could become cleaner as well.  </div></div></div></div>