-
We need to support multiple PseudoTcpSource instances now that PseudoTcpSocket is a GIOStream, since there needs to be one GSource for the input stream, and one for the output stream. They cannot be the same instance, as we need to be able to attach and detach them from the main context independently. Fix this by updating multiple GSources from the PseudoTcpSocket. I investigated an alternative approach for this, where each PseudoTcpSocket would have a child source from the base_socket, and would be triggered by that. While most PseudoTcpSource dispatches are a direct result of dispatches on the base_source, there are some situations, such as timeouts and resizing the send or receive buffer, where the base_source is not sufficient. The conventional alternative here would be to signal this using a GCancellable, and use a GCancellableSource as a child source for each PseudoTcpSource as well. However, that introduces a GObject signal emission into some hot paths in the pseudo-TCP code, which is a bad plan. So stick with an array of GSources whose ready times are manually updated. (This is actually what GCancellableSource does internally anyway, so it’s the same approach in the end, just with some indirection removed.)
8656d5c9