Commit f7d32836 authored by Olivier Crête's avatar Olivier Crête

pseudotcp: Also cause Writable callback to be emitted if can_send() says no

The GOutputStream based systems can sometimes call this, decide the stream is
not writable and then poll for it. We have to make sure that poll is woken up.
parent 34fd83d0
......@@ -1890,23 +1890,23 @@ pseudo_tcp_socket_get_available_bytes (PseudoTcpSocket *self)
gboolean
pseudo_tcp_socket_can_send (PseudoTcpSocket *self)
{
PseudoTcpSocketPrivate *priv = self->priv;
if (priv->state != TCP_ESTABLISHED) {
return FALSE;
}
return (pseudo_tcp_fifo_get_write_remaining (&priv->sbuf) != 0);
return (pseudo_tcp_socket_get_available_send_space (self) > 0);
}
gsize
pseudo_tcp_socket_get_available_send_space (PseudoTcpSocket *self)
{
PseudoTcpSocketPrivate *priv = self->priv;
gsize ret;
if (priv->state != TCP_ESTABLISHED) {
return 0;
}
return pseudo_tcp_fifo_get_write_remaining (&priv->sbuf);
if (priv->state == TCP_ESTABLISHED)
ret = pseudo_tcp_fifo_get_write_remaining (&priv->sbuf);
else
ret = 0;
if (ret == 0)
priv->bWriteEnable = TRUE;
return ret;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment