Commit 312f330a authored by Wandenberg's avatar Wandenberg

refactor on ngx_http_push_stream_websocket_reading to deal with NGX_AGAIN

parent 8e340def
......@@ -178,6 +178,21 @@ typedef struct {
ngx_uint_t backtrack_messages;
} ngx_http_push_stream_requested_channel_t;
typedef struct {
unsigned char fin:1;
unsigned char rsv1:1;
unsigned char rsv2:1;
unsigned char rsv3:1;
unsigned char opcode:4;
unsigned char mask:1;
unsigned char mask_key[4];
uint64_t payload_len;
u_char header[8];
u_char *payload;
u_char *last;
ngx_uint_t step;
} ngx_http_push_stream_frame_t;
typedef struct {
ngx_event_t *disconnect_timer;
ngx_event_t *ping_timer;
......@@ -189,6 +204,7 @@ typedef struct {
ngx_http_push_stream_padding_t *padding;
ngx_str_t *callback;
ngx_http_push_stream_requested_channel_t *requested_channels;
ngx_http_push_stream_frame_t *frame;
} ngx_http_push_stream_module_ctx_t;
// messages to worker processes
......
......@@ -33,18 +33,11 @@
#include <ngx_http_push_stream_module_utils.h>
#include <ngx_http_push_stream_module_subscriber.h>
typedef struct {
unsigned char fin:1;
unsigned char rsv1:1;
unsigned char rsv2:1;
unsigned char rsv3:1;
unsigned char opcode:4;
unsigned char mask:1;
unsigned char mask_key[4];
uint64_t payload_len;
u_char *payload;
} ngx_http_push_stream_frame_t;
static ngx_int_t ngx_http_push_stream_websocket_handler(ngx_http_request_t *r);
#define NGX_HTTP_PUSH_STREAM_WEBSOCKET_READ_START_STEP 0
#define NGX_HTTP_PUSH_STREAM_WEBSOCKET_READ_GET_REAL_SIZE_STEP 1
#define NGX_HTTP_PUSH_STREAM_WEBSOCKET_READ_GET_MASK_KEY_STEP 2
#define NGX_HTTP_PUSH_STREAM_WEBSOCKET_READ_GET_PAYLOAD_STEP 3
#endif /* NGX_HTTP_PUSH_STREAM_MODULE_WEBSOCKET_H_ */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment