Permalink
Browse files

websocket, refactor: remove nouse variable.

  • Loading branch information...
xicilion committed Oct 28, 2017
1 parent 8bdf4cc commit 1f0219888391dc7c1bb9b925f91dc68d8f31d649
Showing with 4 additions and 18 deletions.
  1. +2 −4 fibjs/include/WebSocketMessage.h
  2. +2 −14 fibjs/src/websocket/WebSocketMessage.cpp
@@ -16,17 +16,16 @@ namespace fibjs {
class WebSocketMessage : public WebSocketMessage_base {
public:
WebSocketMessage(int32_t type, bool masked, bool compress, int32_t maxSize, bool bRep = false)
WebSocketMessage(int32_t type, bool masked, bool compress, int32_t maxSize)
: m_masked(masked)
, m_compress(compress)
, m_maxSize(maxSize)
, m_error(0)
, m_bRep(bRep)
{
m_message = new Message(m_bRep);
if (type != ws_base::_TEXT && type != ws_base::_BINARY)
m_compress = false;
m_message = new Message();
m_message->set_type(type);
}
@@ -80,7 +79,6 @@ class WebSocketMessage : public WebSocketMessage_base {
private:
obj_ptr<Message> m_message;
bool m_bRep;
};
} /* namespace fibjs */
@@ -105,7 +105,7 @@ result_t WebSocketMessage::isEnded(bool& retVal)
result_t WebSocketMessage::clear()
{
m_message = new Message(m_bRep);
m_message = new Message();
return 0;
}
@@ -573,19 +573,7 @@ result_t WebSocketMessage::get_stream(obj_ptr<Stream_base>& retVal)
result_t WebSocketMessage::get_response(obj_ptr<Message_base>& retVal)
{
if (m_bRep)
return CHECK_ERROR(CALL_E_INVALID_CALL);
if (!m_message->m_response) {
int32_t type;
get_type(type);
if (type == ws_base::_PING)
type = ws_base::_PONG;
m_message->m_response = new WebSocketMessage(type, false, false, m_maxSize, true);
}
return m_message->get_response(retVal);
return CHECK_ERROR(CALL_E_INVALID_CALL);
}
result_t WebSocketMessage::get_type(int32_t& retVal)

0 comments on commit 1f02198

Please sign in to comment.