Transport calls when the send buffer has room.
171889
def resume_writing(self):
        ''''''
        if not self._can_send.is_set():
            self._can_send.set()
            self.transport.resume_reading()
26331
function onSocketChunk(chunk) {
        var err = self.mach.handleChunk(chunk);
        if (err) {
            self.sendProtocolError('read', err);
        }
    }
1260172
private void sendTransportCandidatesOffer() throws XMPPException, SmackException, InterruptedException {
        List<TransportCandidate> notOffered = resolver.getCandidatesList();

        notOffered.removeAll(offeredCandidates);

        // Send any unset candidate
        for (Object aNotOffered : notOffered) {
            sendTransportCandidateOffer((TransportCandidate) aNotOffered);
        }

        // .. and start a listener that will send any future candidate
        if (resolverListener == null) {
            // Add a listener that sends the offer when the resolver finishes...
            resolverListener = new TransportResolverListener.Resolver() {
                @Override
                public void candidateAdded(TransportCandidate cand) throws NotConnectedException, InterruptedException {
                    sendTransportCandidateOffer(cand);
                }

                @Override
                public void end() {
                }

                @Override
                public void init() {
                }
            };

            resolver.addListener(resolverListener);
        }

        if (!(resolver.isResolving() || resolver.isResolved())) {
            // Resolve our IP and port
            LOGGER.fine("RESOLVER CALLED");
            resolver.resolve(session);
        }
    }
505718
def send(self, frame):
        
        dest = frame.headers.get('destination')
        if not dest:
            raise ProtocolError('Missing destination for SEND command.')

        if dest.startswith('/queue/'):
            self.engine.queue_manager.send(frame)
        else:
            self.engine.topic_manager.send(frame)
464739
void send(final long destinations[], final VoltMessage message) {
        if (!m_isUp) {
            hostLog.warn("Failed to send VoltMessage because connection to host " +
                    CoreUtils.getHostIdFromHSId(destinations[0])+ " is closed");
            return;
        }
        if (destinations.length == 0) {
            return;
        }

        // if this link is "gone silent" for partition tests, just drop the message on the floor
        if (!m_linkCutForTest.get()) {
            m_network.enqueue(
                    new DeferredSerialization() {
                        @Override
                        public final void serialize(final ByteBuffer buf) throws IOException {
                            buf.putInt(buf.capacity() - 4);
                            buf.putLong(message.m_sourceHSId);
                            buf.putInt(destinations.length);
                            for (int ii = 0; ii < destinations.length; ii++) {
                                buf.putLong(destinations[ii]);
                            }
                            message.flattenToBuffer(buf);
                            buf.flip();
                        }

                        @Override
                        public final void cancel() {
                        /*
                         * Can this be removed?
                         */
                        }

                        @Override
                        public String toString() {
                            return message.getClass().getName();
                        }

                        @Override
                        public int getSerializedSize() {
                            final int len = 4            /* length prefix */
                                    + 8            /* source hsid */
                                    + 4            /* destinationCount */
                                    + 8 * destinations.length  /* destination list */
                                    + message.getSerializedSize();
                            return len;
                        }
                    });
        }

        long current_time = EstTime.currentTimeMillis();
        long current_delta = current_time - m_lastMessageMillis.get();
        /*
         * Try and give some warning when a connection is timing out.
         * Allows you to observe the liveness of the host receiving the heartbeats
         */
        if (isPrimary() && current_delta > m_logRate) {
            rateLimitedLogger.log(
                    "Have not received a message from host "
                        + hostnameAndIPAndPort() + " for " + (current_delta / 1000.0) + " seconds",
                        current_time);
        }
        // NodeFailureFault no longer immediately trips FHInputHandler to
        // set m_isUp to false, so use both that and m_closing to
        // avoid repeat reports of a single node failure
        if ((!m_closing && m_isUp) &&
                isPrimary() &&
                current_delta > m_deadHostTimeout)
        {
            if (m_deadReportsCount.getAndIncrement() == 0) {
                hostLog.error("DEAD HOST DETECTED, hostname: " + hostnameAndIPAndPort());
                hostLog.info("\tcurrent time: " + current_time);
                hostLog.info("\tlast message: " + m_lastMessageMillis);
                hostLog.info("\tdelta (millis): " + current_delta);
                hostLog.info("\ttimeout value (millis): " + m_deadHostTimeout);
                VoltDB.dropStackTrace("Timed out foreign host " + hostnameAndIPAndPort() + " with delta " + current_delta);
            }
            m_hostMessenger.reportForeignHostFailed(m_hostId);
        }
    }
1337880
public void send(ByteArrayOutputStream bos) {
    try {
      if (this.isDisabled) {
        return;
      }
      if (available.tryAcquire(WAIT_NEXT_BUFFER_TIME_OUT_SECONDS, TimeUnit.SECONDS)) {
        tasks.add(sendExecutor.submit(new SendWorker(bos, segmentId++, false)));
      } else {
        setErrorStatus("Number of chunks in the queue to be send exceeded the configured number " 
             + maxBufferedChunks, null);
      }
    } catch (Exception e) {
      setErrorStatus("Exception when submitting a task", e);
    }
  }
114454
def connection_made(self, transport):
        """"""
        self.log.info('Connection established to AVR')
        self.transport = transport

        #self.transport.set_write_buffer_limits(0)
        limit_low, limit_high = self.transport.get_write_buffer_limits()
        self.log.debug('Write buffer limits %d to %d', limit_low, limit_high)

        self.command('ECH1')
        self.refresh_core()
147299
def _writeToTransport(self, data):
        ''''''
        self.transport.writeData(data)
        self.heartbeater.schedule()
782203
def _setup_transport(self):
        """"""
        self._write = self.sock.sendall
        self._read_buffer = EMPTY_BUFFER
        self._quick_recv = self.sock.recv
138112
def send(frame)
      if Frame::Data === frame
        @send_buffer << frame
        if @send_remaining_window < frame.length
          if Stream === self
            connection.callback(:send_deferred, self, frame)
          else
            callback(:send_deferred, self, frame)
          end
        else
          consume_send_buffer
        end
      else
        send_immediately frame
      end
    end
735849
private void moveDataIntoReadBufferArray(WsByteBuffer newReadBuffer) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "moveDataIntoReadBufferArray entry: stream " + myID + " buffer: " + newReadBuffer);
        }

        // move the data that is to be sent up the channel into the currentReadReady byte array, and update the currentReadSize
        if (newReadBuffer != null) {
            int size = newReadBuffer.remaining(); // limit - pos
            if (size > 0) {
                streamReadReady.add(newReadBuffer);
                streamReadSize += size;
                this.readLatch.countDown();
            }
        }
    }
1228552
@Override
	public void send( AbstractPacket packet ) throws PacketTransportException
    {
        if (closed)
   			throw new PacketTransportException("Transport is closed");
        
        sender.send(packet);
    }
617222
void onTransportIdle() {
    isActive = false;
    if (shutdownFuture == null) {
      return;
    }
    if (shutdownFuture.isDone()) {
      shutdownDelayed = false;
      shutdownFuture = scheduler
          .schedule(shutdownTask, maxConnectionIdleInNanos, TimeUnit.NANOSECONDS);
    } else {
      nextIdleMonitorTime = ticker.nanoTime() + maxConnectionIdleInNanos;
    }
  }
462709
private synchronized void sendTransportCandidateOffer(TransportCandidate cand) throws NotConnectedException, InterruptedException {
        if (!cand.isNull()) {
            // Offer our new candidate...
            addOfferedCandidate(cand);
            JingleContent content = parentNegotiator.getJingleContent();
            content.addJingleTransport(getJingleTransport(cand));
            Jingle jingle = new Jingle(JingleActionEnum.TRANSPORT_INFO);
            jingle.addContent(content);

            // We SHOULD NOT be sending packets directly.
            // This circumvents the state machinery.
            // TODO - work this into the state machinery.
            session.sendFormattedJingle(jingle);
        }
    }
1196441
def sendTo(self, dest, chunkSize):
        
        vol = self.toVol
        paths = self.sink.getPaths(vol)

        if self.sink == dest:
            logger.info("Keep: %s", self)
            self.sink.keep(self)
        else:
            # Log, but don't skip yet, so we can log more detailed skipped actions later
            skipDryRun(logger, dest.dryrun, 'INFO')("Xfer: %s", self)

            receiveContext = dest.receive(self, paths)

            sendContext = self.sink.send(self)

            # try:
            #     receiveContext.metadata['btrfsVersion'] = self.btrfsVersion
            # except AttributeError:
            #     pass

            transfer(sendContext, receiveContext, chunkSize)

        if vol.hasInfo():
            infoContext = dest.receiveVolumeInfo(paths)

            if infoContext is None:
                # vol.writeInfo(sys.stdout)
                pass
            else:
                with infoContext as stream:
                    vol.writeInfo(stream)
573818
private void transferEntry(long index, Entry entry, Segment compactSegment) {
    compactSegment.append(entry);

    // If the entry was released in the prior segment, mark it as released in the compact segment.
    if (!segment.isLive(index)) {
      compactSegment.release(index);
    }
  }
1065990
def _on_send_complete(self, handle, error):
        """"""
        assert handle is self._handle
        self._write_buffer_size -= 1
        assert self._write_buffer_size >= 0
        if self._error:
            self._log.debug('ignore sendto status {} after error', error)
        # See note in _on_write_complete() about UV_ECANCELED
        elif error and error != pyuv.errno.UV_ECANCELED:
            self._log.warning('pyuv error {} in sendto callback', error)
            self._protocol.error_received(TransportError.from_errno(error))
        self._maybe_resume_protocol()
        self._maybe_close()