static int uwsgi_websocket_send_do(struct wsgi_request *wsgi_req, char *msg, size_t len) { struct uwsgi_buffer *ub = uwsgi_websocket_message(msg, len); if (!ub) return -1; ssize_t ret = uwsgi_response_write_body_do(wsgi_req, ub->buf, ub->pos); uwsgi_buffer_destroy(ub); return ret; }
static int uwsgi_websocket_send_from_sharedarea_do(struct wsgi_request *wsgi_req, int id, uint64_t pos, uint64_t len, uint8_t opcode) { struct uwsgi_sharedarea *sa = uwsgi_sharedarea_get_by_id(id, pos); if (!sa) return -1; if (!len) { len = sa->honour_used ? sa->used-pos : ((sa->max_pos+1)-pos); } uwsgi_rlock(sa->lock); sa->hits++; struct uwsgi_buffer *ub = uwsgi_websocket_message(wsgi_req, sa->area, len, opcode); uwsgi_rwunlock(sa->lock); if (!ub) return -1; return uwsgi_response_write_body_do(wsgi_req, ub->buf, ub->pos); }
static int uwsgi_websocket_send_do(struct wsgi_request *wsgi_req, char *msg, size_t len, uint8_t opcode) { struct uwsgi_buffer *ub = uwsgi_websocket_message(wsgi_req, msg, len, opcode); if (!ub) return -1; return uwsgi_response_write_body_do(wsgi_req, ub->buf, ub->pos); }