* Switching from char to uint8_t

* Adding sockfd to ::close()
This commit is contained in:
David Baird
2013-05-14 11:11:07 -06:00
parent a3eeff2a1b
commit 50c2d0e18d
+5 -5
View File
@@ -105,8 +105,8 @@ struct _RealWebSocket : public WebSocket
uint8_t masking_key[4]; uint8_t masking_key[4];
}; };
std::vector<char> rxbuf; std::vector<uint8_t> rxbuf;
std::vector<char> txbuf; std::vector<uint8_t> txbuf;
int sockfd; int sockfd;
readyStateValues readyState; readyStateValues readyState;
@@ -149,7 +149,7 @@ struct _RealWebSocket : public WebSocket
else { break; } else { break; }
} }
if (!txbuf.size() && readyState == CLOSING) { if (!txbuf.size() && readyState == CLOSING) {
::close(); ::close(sockfd);
readyState = CLOSED; readyState = CLOSED;
} }
} }
@@ -257,8 +257,8 @@ struct _RealWebSocket : public WebSocket
void close() { void close() {
if(readyState == CLOSING || readyState == CLOSED) { return; } if(readyState == CLOSING || readyState == CLOSED) { return; }
readyState = CLOSING; readyState = CLOSING;
char closeFrame[4] = {0x88, 0x00, 0x00, 0x00}; uint8_t closeFrame[4] = {0x88, 0x00, 0x00, 0x00};
std::vector<char> header(closeFrame, closeFrame+4); std::vector<uint8_t> header(closeFrame, closeFrame+4);
txbuf.insert(txbuf.end(), header.begin(), header.end()); txbuf.insert(txbuf.end(), header.begin(), header.end());
} }