mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
修复websock相关bug
This commit is contained in:
parent
9fdf05bed0
commit
cacd241223
@ -101,9 +101,10 @@ public:
|
||||
}
|
||||
//每隔一段时间触发,用来做超时管理
|
||||
void onManager() override{
|
||||
HttpSessionType::onManager();
|
||||
if(_session){
|
||||
_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);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
ret.push_back(byte);
|
||||
|
||||
uint16_t len = htons(len);
|
||||
ret.append((char *)&len,2);
|
||||
auto len_low = htons(len);
|
||||
ret.append((char *)&len_low,2);
|
||||
}else{
|
||||
byte |= 127;
|
||||
ret.push_back(byte);
|
||||
|
@ -91,7 +91,7 @@ public:
|
||||
* @param data 负载数据
|
||||
* @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:
|
||||
/**
|
||||
* 收到一个webSocket数据包包头,后续将继续触发onWebSocketDecodePlayload回调
|
||||
|
Loading…
Reference in New Issue
Block a user