more detail printf for handshake

This commit is contained in:
xiongguangjie 2022-06-22 18:26:37 +08:00
parent 90874b2b04
commit dea848610a
3 changed files with 9 additions and 6 deletions

View File

@ -230,7 +230,7 @@ std::string HandshakePacket::dump(){
printer <<"flag:"<< (int)f<<"\r\n"; printer <<"flag:"<< (int)f<<"\r\n";
printer <<"control_type:"<< (int)control_type<<"\r\n"; printer <<"control_type:"<< (int)control_type<<"\r\n";
printer <<"sub_type:"<< (int)sub_type<<"\r\n"; printer <<"sub_type:"<< (int)sub_type<<"\r\n";
printer <<"type_specific_info:"<< type_specific_info[0]<<":"<<type_specific_info[1]<<":"<<type_specific_info[2]<<":"<<type_specific_info[3]<<"\r\n"; printer <<"type_specific_info:"<< (int)type_specific_info[0]<<":"<<(int)type_specific_info[1]<<":"<<(int)type_specific_info[2]<<":"<<(int)type_specific_info[3]<<"\r\n";
printer <<"timestamp:"<< timestamp<<"\r\n"; printer <<"timestamp:"<< timestamp<<"\r\n";
printer <<"dst_socket_id:"<< dst_socket_id<<"\r\n"; printer <<"dst_socket_id:"<< dst_socket_id<<"\r\n";
@ -245,7 +245,7 @@ std::string HandshakePacket::dump(){
printer <<"syn_cookie:"<< syn_cookie<<"\r\n"; printer <<"syn_cookie:"<< syn_cookie<<"\r\n";
printer <<"peer_ip_addr:"; printer <<"peer_ip_addr:";
for(size_t i=0;i<sizeof(peer_ip_addr);++i){ for(size_t i=0;i<sizeof(peer_ip_addr);++i){
printer<<peer_ip_addr[i]<<":"; printer<<(int)peer_ip_addr[i]<<":";
} }
printer<<"\r\n"; printer<<"\r\n";

View File

@ -118,9 +118,9 @@ public:
USERDEFINEDTYPE = 0x7FFF USERDEFINEDTYPE = 0x7FFF
}; };
uint32_t sub_type : 16; uint16_t sub_type;
uint32_t control_type : 15; uint16_t control_type;
uint32_t f : 1; uint8_t f;
uint8_t type_specific_info[4]; uint8_t type_specific_info[4];
uint32_t timestamp; uint32_t timestamp;
uint32_t dst_socket_id; uint32_t dst_socket_id;

View File

@ -228,7 +228,10 @@ void SrtTransport::handleHandshakeConclusion(HandshakePacket &pkt, struct sockad
void SrtTransport::handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr) { void SrtTransport::handleHandshake(uint8_t *buf, int len, struct sockaddr_storage *addr) {
HandshakePacket pkt; HandshakePacket pkt;
assert(pkt.loadFromData(buf, len)); if(!pkt.loadFromData(buf, len)){
WarnL<<"is not vaild HandshakePacket";
return;
}
if (pkt.handshake_type == HandshakePacket::HS_TYPE_INDUCTION) { if (pkt.handshake_type == HandshakePacket::HS_TYPE_INDUCTION) {
handleHandshakeInduction(pkt, addr); handleHandshakeInduction(pkt, addr);