mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add SrsPid and SrsId to client response, add pid to log
This commit is contained in:
parent
5ff1ce7cba
commit
e39eed6519
8 changed files with 57 additions and 9 deletions
|
@ -492,7 +492,33 @@ int SrsRtmpClient::connect_app(string app, string tc_url)
|
|||
}
|
||||
SrsAutoFree(SrsMessage, msg);
|
||||
SrsAutoFree(SrsConnectAppResPacket, pkt);
|
||||
srs_info("get connect app response message");
|
||||
|
||||
// server info
|
||||
std::string srs_version;
|
||||
std::string srs_server_ip;
|
||||
int srs_id = 0;
|
||||
int srs_pid = 0;
|
||||
|
||||
SrsAmf0Any* data = pkt->info->get_property("data");
|
||||
if (data && data->is_ecma_array()) {
|
||||
SrsAmf0EcmaArray* arr = data->to_ecma_array();
|
||||
|
||||
SrsAmf0Any* prop = NULL;
|
||||
if ((prop = arr->ensure_property_string("srs_version")) != NULL) {
|
||||
srs_version = prop->to_str();
|
||||
}
|
||||
if ((prop = arr->ensure_property_string("srs_server_ip")) != NULL) {
|
||||
srs_server_ip = prop->to_str();
|
||||
}
|
||||
if ((prop = arr->ensure_property_number("srs_id")) != NULL) {
|
||||
srs_id = (int)prop->to_number();
|
||||
}
|
||||
if ((prop = arr->ensure_property_number("srs_pid")) != NULL) {
|
||||
srs_pid = (int)prop->to_number();
|
||||
}
|
||||
}
|
||||
srs_trace("connected, version=%s, ip=%s, identity=[%d][%d]",
|
||||
srs_version.c_str(), srs_server_ip.c_str(), srs_pid, srs_id);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -867,6 +893,7 @@ int SrsRtmpServer::response_connect_app(SrsRequest *req, const char* server_ip)
|
|||
data->set("srs_server_ip", SrsAmf0Any::str(server_ip));
|
||||
}
|
||||
// for edge to directly get the id of client.
|
||||
data->set("srs_pid", SrsAmf0Any::number(getpid()));
|
||||
data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));
|
||||
|
||||
if ((ret = protocol->send_and_free_packet(pkt, 0)) != ERROR_SUCCESS) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue