mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
修复websock相关bug
This commit is contained in:
parent
9fdf05bed0
commit
cacd241223
@ -101,9 +101,10 @@ public:
|
|||||||
}
|
}
|
||||||
//每隔一段时间触发,用来做超时管理
|
//每隔一段时间触发,用来做超时管理
|
||||||
void onManager() override{
|
void onManager() override{
|
||||||
HttpSessionType::onManager();
|
|
||||||
if(_session){
|
if(_session){
|
||||||
_session->onManager();
|
_session->onManager();
|
||||||
|
}else{
|
||||||
|
HttpSessionType::onManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +163,7 @@ void WebSocketSplitter::onPlayloadData(uint8_t *ptr, uint64_t len) {
|
|||||||
onWebSocketDecodePlayload(*this, _mask_flag ? ptr - len : ptr, len, _playload_offset);
|
onWebSocketDecodePlayload(*this, _mask_flag ? ptr - len : ptr, len, _playload_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebSocketSplitter::encode(const WebSocketHeader &header,uint8_t *data, uint64_t len) {
|
void WebSocketSplitter::encode(const WebSocketHeader &header,uint8_t *data, const uint64_t len) {
|
||||||
string ret;
|
string ret;
|
||||||
|
|
||||||
uint8_t byte = header._fin << 7 | ((header._reserved & 0x07) << 4) | (header._opcode & 0x0F) ;
|
uint8_t byte = header._fin << 7 | ((header._reserved & 0x07) << 4) | (header._opcode & 0x0F) ;
|
||||||
@ -179,8 +179,8 @@ void WebSocketSplitter::encode(const WebSocketHeader &header,uint8_t *data, uint
|
|||||||
byte |= 126;
|
byte |= 126;
|
||||||
ret.push_back(byte);
|
ret.push_back(byte);
|
||||||
|
|
||||||
uint16_t len = htons(len);
|
auto len_low = htons(len);
|
||||||
ret.append((char *)&len,2);
|
ret.append((char *)&len_low,2);
|
||||||
}else{
|
}else{
|
||||||
byte |= 127;
|
byte |= 127;
|
||||||
ret.push_back(byte);
|
ret.push_back(byte);
|
||||||
|
@ -91,7 +91,7 @@ public:
|
|||||||
* @param data 负载数据
|
* @param data 负载数据
|
||||||
* @param len 负载数据长度
|
* @param len 负载数据长度
|
||||||
*/
|
*/
|
||||||
void encode(const WebSocketHeader &header,uint8_t *data,uint64_t len);
|
void encode(const WebSocketHeader &header,uint8_t *data,const uint64_t len);
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* 收到一个webSocket数据包包头,后续将继续触发onWebSocketDecodePlayload回调
|
* 收到一个webSocket数据包包头,后续将继续触发onWebSocketDecodePlayload回调
|
||||||
|
Loading…
Reference in New Issue
Block a user