Skip to content

Commit 9f8eccd

Browse files
committed
optimizations
1 parent 5536791 commit 9f8eccd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/cwebsocket/client.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ int cwebsocket_client_read_handshake(cwebsocket_client *websocket, char *seckey)
411411

412412
tmplen = bytes_read - 3;
413413
char buf[tmplen+1];
414-
memset(buf, 0, tmplen+1);
415414
memcpy(buf, data, tmplen);
416415
buf[tmplen+1] = '\0';
417416

@@ -452,7 +451,7 @@ int cwebsocket_client_send_control_frame(cwebsocket_client *websocket, opcode co
452451
control_frame[3] = masking_key[1];
453452
control_frame[4] = masking_key[2];
454453
control_frame[5] = masking_key[3];
455-
if(strcmp(frame_type, "CLOSE") == 0) {
454+
if(code & CLOSE) {
456455
uint16_t close_code = 0;
457456
if(payload_len >= 2) {
458457
control_frame[6] = payload[0];

0 commit comments

Comments
 (0)