diff --git a/src/Http/HttpsSession.h b/src/Http/HttpsSession.h index 251c34bc..de26c2b7 100644 --- a/src/Http/HttpsSession.h +++ b/src/Http/HttpsSession.h @@ -101,9 +101,10 @@ public: } //每隔一段时间触发,用来做超时管理 void onManager() override{ - HttpSessionType::onManager(); if(_session){ _session->onManager(); + }else{ + HttpSessionType::onManager(); } } diff --git a/src/Http/WebSocketSplitter.cpp b/src/Http/WebSocketSplitter.cpp index 25589e45..3a026811 100644 --- a/src/Http/WebSocketSplitter.cpp +++ b/src/Http/WebSocketSplitter.cpp @@ -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); diff --git a/src/Http/WebSocketSplitter.h b/src/Http/WebSocketSplitter.h index 37150b41..ef8bf9eb 100644 --- a/src/Http/WebSocketSplitter.h +++ b/src/Http/WebSocketSplitter.h @@ -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回调