void NetworkInterfaceASIO::_beginCommunication(AsyncOp* op) { if (op->canceled()) { return _completeOperation(op, kCanceledStatus); } auto negotiatedProtocol = rpc::negotiate(op->connection()->serverProtocols(), op->connection()->clientProtocols()); if (!negotiatedProtocol.isOK()) { return _completeOperation(op, negotiatedProtocol.getStatus()); } op->setOperationProtocol(negotiatedProtocol.getValue()); op->setToSend(std::move(*_messageFromRequest(op->request(), negotiatedProtocol.getValue()))); // TODO: Is this logic actually necessary (SERVER-19320)? if (op->toSend()->empty()) return _completedWriteCallback(op); // TODO: Some day we may need to support vector messages. fassert(28708, op->toSend()->buf() != 0); asio::const_buffer buf(op->toSend()->buf(), op->toSend()->size()); return _asyncSendSimpleMessage(op, buf); }
void NetworkInterfaceASIO::_beginCommunication(AsyncOp* op) { if (op->canceled()) { return _completeOperation(op, kCanceledStatus); } Message* toSend = op->toSend(); _messageFromRequest(op->request(), toSend); if (toSend->empty()) return _completedWriteCallback(op); // TODO: Some day we may need to support vector messages. fassert(28708, toSend->buf() != 0); asio::const_buffer buf(toSend->buf(), toSend->size()); return _asyncSendSimpleMessage(op, buf); }