}
}
+ domain_memory_add_nochk(conn->id, -out->hdr.msg.len - sizeof(out->hdr));
+
if (out->hdr.msg.type == XS_WATCH_EVENT) {
req = out->pend.req;
if (req) {
bdata->timeout_msec = 0;
bdata->watch_event = false;
- if (len <= DEFAULT_BUFFER_SIZE)
+ if (len <= DEFAULT_BUFFER_SIZE) {
bdata->buffer = bdata->default_buffer;
- else {
+ /* Don't check quota, path might be used for returning error. */
+ domain_memory_add_nochk(conn->id, len + sizeof(bdata->hdr));
+ } else {
bdata->buffer = talloc_array(bdata, char, len);
- if (!bdata->buffer) {
+ if (!bdata->buffer ||
+ domain_memory_add_chk(conn->id, len + sizeof(bdata->hdr))) {
send_error(conn, ENOMEM);
return;
}
}
}
+ if (domain_memory_add_chk(conn->id, len + sizeof(bdata->hdr))) {
+ talloc_free(bdata);
+ return;
+ }
+
if (timeout_watch_event_msec && domain_is_unprivileged(conn)) {
bdata->timeout_msec = get_now_msec() + timeout_watch_event_msec;
if (!conn->timeout_msec)
*/
if (bdata->hdr.msg.type != XS_WATCH_EVENT)
domain_outstanding_inc(conn);
+ /*
+ * We are restoring the state after Live-Update and the new quota may
+ * be smaller. So ignore it. The limit will be applied for any resource
+ * after the state has been fully restored.
+ */
+ domain_memory_add_nochk(conn->id, len + sizeof(bdata->hdr));
}
void read_state_buffered_data(const void *ctx, struct connection *conn,