| 537 | } |
| 538 | |
| 539 | void PackUbrpcRequest(butil::IOBuf* buf, |
| 540 | SocketMessage**, |
| 541 | uint64_t correlation_id, |
| 542 | const google::protobuf::MethodDescriptor*, |
| 543 | Controller* controller, |
| 544 | const butil::IOBuf& request, |
| 545 | const Authenticator* /*not supported*/) { |
| 546 | ControllerPrivateAccessor accessor(controller); |
| 547 | if (controller->connection_type() == CONNECTION_TYPE_SINGLE) { |
| 548 | return controller->SetFailed( |
| 549 | EINVAL, "ubrpc protocol can't work with CONNECTION_TYPE_SINGLE"); |
| 550 | } |
| 551 | // Store `correlation_id' into Socket since ubrpc protocol doesn't |
| 552 | // contain this field |
| 553 | accessor.get_sending_socket()->set_correlation_id(correlation_id); |
| 554 | |
| 555 | nshead_t nshead; |
| 556 | memset(&nshead, 0, sizeof(nshead_t)); |
| 557 | nshead.log_id = controller->log_id(); |
| 558 | nshead.magic_num = NSHEAD_MAGICNUM; |
| 559 | nshead.body_len = request.size(); |
| 560 | nshead.version = UBRPC_NSHEAD_VERSION; |
| 561 | buf->append(&nshead, sizeof(nshead)); |
| 562 | |
| 563 | // Span* span = accessor.span(); |
| 564 | // if (span) { |
| 565 | // request_meta->set_trace_id(span->trace_id()); |
| 566 | // request_meta->set_span_id(span->span_id()); |
| 567 | // request_meta->set_parent_span_id(span->parent_span_id()); |
| 568 | // } |
| 569 | buf->append(request); |
| 570 | } |
| 571 | |
| 572 | } // namespace policy |
| 573 | } // namespace brpc |
nothing calls this directly
no test coverage detected