MCPcopy Create free account
hub / github.com/apache/brpc / OnError

Method OnError

src/brpc/policy/rtmp_protocol.cpp:2515–2542  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2513}
2514
2515bool RtmpChunkStream::OnError(const RtmpMessageHeader& mh,
2516 AMFInputStream* istream,
2517 Socket* socket) {
2518 uint32_t transaction_id = 0;
2519 if (!ReadAMFUint32(&transaction_id, istream)) {
2520 RTMP_ERROR(socket, mh) << "Fail to read _error.TransactionId";
2521 return false;
2522 }
2523 if (transaction_id < 2) {
2524 if (transaction_id == 1) {
2525 connection_context()->OnConnected(-1);
2526 } // else nothing to do with transaction_id=0
2527 return true;
2528 }
2529 if (connection_context()->unconnected()) {
2530 RTMP_ERROR(socket, mh) << "Received _error.TransactionId="
2531 << transaction_id << " before connected";
2532 }
2533 RtmpContext* ctx = static_cast<RtmpContext*>(socket->parsing_context());
2534 RtmpTransactionHandler* handler = ctx->RemoveTransaction(transaction_id);
2535 if (handler == NULL) {
2536 RTMP_WARNING(socket, mh) << "Unknown _error.TransactionId="
2537 << transaction_id;
2538 return false;
2539 }
2540 handler->Run(true, mh, istream, socket);
2541 return true;
2542}
2543
2544bool RtmpChunkStream::OnStatus(const RtmpMessageHeader& mh,
2545 AMFInputStream* istream,

Callers

nothing calls this directly

Calls 5

ReadAMFUint32Function · 0.85
OnConnectedMethod · 0.80
unconnectedMethod · 0.80
RemoveTransactionMethod · 0.80
RunMethod · 0.45

Tested by

no test coverage detected