if (!PKT_FIELD(vsk, peer_waiting_write)) returnfalse;
/* When the sender blocks, we take that as a sign that the sender is * faster than the receiver. To reduce the transmit rate of the sender, * we delay the sending of the read notification by decreasing the * write_notify_window. The notification is delayed until the number of * bytes used in the queue drops below the write_notify_window.
*/
/* The notify_limit is used to delay notifications in the case where * flow control is enabled. Below the test is expressed in terms of * free space in the queue: if free_space > ConsumeSize - * write_notify_window then notify An alternate way of expressing this * is to rewrite the expression to use the data ready in the receive * queue: if write_notify_window > bufferReady then notify as * free_space == ConsumeSize - bufferReady.
*/
if (vmci_transport_notify_waiting_write(vsk)) { /* Notify the peer that we have read, retrying the send on * failure up to our maximum value. XXX For now we just log * the failure, but later we should schedule a work item to * handle the resend until it succeeds. That would require * keeping track of work items in the vsk and cleaning them up * upon socket close.
*/ while (!(vsk->peer_shutdown & RCV_SHUTDOWN) &&
!sent_read &&
retries < VMCI_TRANSPORT_MAX_DGRAM_RESENDS) {
err = vmci_transport_send_read(sk); if (err >= 0)
sent_read = true;
retries++;
}
if (retries >= VMCI_TRANSPORT_MAX_DGRAM_RESENDS && !sent_read)
pr_err("%p unable to send read notification to peer\n",
sk); else
PKT_FIELD(vsk, peer_waiting_write) = false;
if (vsock_stream_has_data(vsk) >= target) {
*data_ready_now = true;
} else { /* We can't read right now because there is not enough data * in the queue. Ask for notifications when there is something * to read.
*/ if (sk->sk_state == TCP_ESTABLISHED)
vsock_block_update_write_window(sk);
*data_ready_now = false;
}
produce_q_free_space = vsock_stream_has_space(vsk); if (produce_q_free_space > 0) {
*space_avail_now = true; return0;
} elseif (produce_q_free_space == 0) { /* This is a connected socket but we can't currently send data. * Nothing else to do.
*/
*space_avail_now = false;
}
if (PKT_FIELD(vsk, write_notify_min_window) < target + 1) {
PKT_FIELD(vsk, write_notify_min_window) = target + 1; if (PKT_FIELD(vsk, write_notify_window) <
PKT_FIELD(vsk, write_notify_min_window)) { /* If the current window is smaller than the new * minimal window size, we need to reevaluate whether * we need to notify the sender. If the number of ready * bytes are smaller than the new window, we need to * send a notification to the sender before we block.
*/
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.