summaryrefslogtreecommitdiffstats
path: root/bower.json
blob: 6cfc6ace0c14521383b03578e2d79c915aa8c2d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
{
  "name": "vaadin-core",
  "authors": [
    "Vaadin Ltd"
  ],
  "description": "The Vaadin core components are an evolving set of free and open source, standards-based web components.",
  "license": "Apache-2.0",
  "keywords": [
    "vaadin",
    "core",
    "elements",
    "web",
    "components",
    "webcomponents",
    "web-components",
    "element-collection"
  ],
  "main": "vaadin-core.html",
  "ignore": [
    "**/.*",
    "**/node_modules",
    "**/bower_components",
    "**/test",
    "**/tests",
    "**/vaadin-core.js"
  ],
  "dependencies": {
    "polymer": "polymer#2.7.0",
    "shadycss": "shadycss#1.8.0",
    "vaadin-accordion": "vaadin-accordion#1.0.0",
    "vaadin-button": "vaadin-button#2.1.5",
    "vaadin-checkbox": "vaadin-checkbox#2.2.7",
    "vaadin-combo-box": "vaadin-combo-box#4.2.8",
    "vaadin-context-menu": "vaadin-context-menu#4.3.4",
    "vaadin-control-state-mixin": "vaadin-control-state-mixin#2.1.3",
    "vaadin-date-picker": "vaadin-date-picker#3.3.4",
    "vaadin-time-picker": "vaadin-time-picker#1.2.2",
    "vaadin-development-mode-detector": "vaadin-development-mode-detector#2.0.0",
    "vaadin-details": "vaadin-details#1.0.1",
    "vaadin-dialog": "vaadin-dialog#2.2.1",
    "vaadin-select": "vaadin-select#2.0.4",
    "vaadin-element-mixin": "vaadin-element-mixin#2.1.3",
    "vaadin-form-layout": "vaadin-form-layout#2.1.2",
    "vaadin-grid": "vaadin-grid#5.3.3",
    "vaadin-icons": "vaadin-icons#4.3.1",
    "iron-a11y-announcer": "iron-a11y-announcer#2.1.0",
    "iron-a11y-keys-behavior": "iron-a11y-keys-behavior#2.1.1",
    "iron-fit-behavior": "iron-fit-behavior#2.2.1",
    "iron-flex-layout": "iron-flex-layout#2.0.3",
    "iron-icon": "iron-icon#2.1.0",
    "iron-iconset-svg": "iron-iconset-svg#2.2.1",
    "iron-list": "iron-list#2.0.19",
    "iron-media-query": "iron-media-query#2.1.0",
    "iron-meta": "iron-meta#2.1.1",
    "iron-overlay-behavior": "iron-overlay-behavior#2.3.4",
    "iron-resizable-behavior": "iron-resizable-behavior#2.1.1",
    "iron-scroll-target-behavior": "iron-scroll-target-behavior#2.1.1",
    "vaadin-item": "vaadin-item#2.1.0",
    "vaadin-list-box": "vaadin-list-box#1.1.0",
    "vaadin-list-mixin": "vaadin-list-mixin#2.2.1",
    "vaadin-lumo-styles": "vaadin-lumo-styles#1.4.2",
    "vaadin-material-styles": "vaadin-material-styles#1.2.2",
    "vaadin-notification": "vaadin-notification#1.3.0",
    "vaadin-ordered-layout": "vaadin-ordered-layout#1.1.0",
    "vaadin-overlay": "vaadin-overlay#3.2.11",
    "vaadin-progress-bar": "vaadin-progress-bar#1.1.0",
    "vaadin-radio-button": "vaadin-radio-button#1.2.0",
    "vaadin-split-layout": "vaadin-split-layout#4.1.0",
    "vaadin-tabs": "vaadin-tabs#2.1.2",
    "vaadin-text-field": "vaadin-text-field#2.4.0",
    "vaadin-themable-mixin": "vaadin-themable-mixin#1.4.4",
    "vaadin-upload": "vaadin-upload#4.2.1",
    "vaadin-custom-field": "vaadin-custom-field#1.0.1",
    "vaadin-app-layout": "vaadin-app-layout#2.0.0-beta1",
    "vaadin-login": "vaadin-login#1.0.0",
    "webcomponentsjs": "webcomponentsjs#1.2.6",
    "vaadin-usage-statistics": "vaadin-usage-statistics#2.0.2"
  }
}
lass="cp"> rspamd_events_log_id, "events", session->pool->tag.uid, \ G_STRFUNC, \ __VA_ARGS__) INIT_LOG_MODULE(events) /* Average symbols count to optimize hash allocation */ static struct rspamd_counter_data events_count; struct rspamd_async_event { const char *subsystem; const char *event_source; event_finalizer_t fin; void *user_data; }; static inline bool rspamd_event_equal(const struct rspamd_async_event *ev1, const struct rspamd_async_event *ev2) { return ev1->fin == ev2->fin && ev1->user_data == ev2->user_data; } static inline uint64_t rspamd_event_hash(const struct rspamd_async_event *ev) { union _pointer_fp_thunk { event_finalizer_t f; gpointer p; }; struct ev_storage { union _pointer_fp_thunk p; gpointer ud; } st; st.p.f = ev->fin; st.ud = ev->user_data; return rspamd_cryptobox_fast_hash(&st, sizeof(st), rspamd_hash_seed()); } /* Define **SET** of events */ KHASH_INIT(rspamd_events_hash, struct rspamd_async_event *, char, false, rspamd_event_hash, rspamd_event_equal); struct rspamd_async_session { session_finalizer_t fin; event_finalizer_t restore; event_finalizer_t cleanup; khash_t(rspamd_events_hash) * events; void *user_data; rspamd_mempool_t *pool; unsigned int flags; }; static void rspamd_session_dtor(gpointer d) { struct rspamd_async_session *s = (struct rspamd_async_session *) d; /* Events are usually empty at this point */ rspamd_set_counter_ema(&events_count, s->events->n_buckets, 0.5); kh_destroy(rspamd_events_hash, s->events); } struct rspamd_async_session * rspamd_session_create(rspamd_mempool_t *pool, session_finalizer_t fin, event_finalizer_t restore, event_finalizer_t cleanup, void *user_data) { struct rspamd_async_session *s; s = rspamd_mempool_alloc0(pool, sizeof(struct rspamd_async_session)); s->pool = pool; s->fin = fin; s->restore = restore; s->cleanup = cleanup; s->user_data = user_data; s->events = kh_init(rspamd_events_hash); kh_resize(rspamd_events_hash, s->events, MAX(4, events_count.mean)); rspamd_mempool_add_destructor(pool, rspamd_session_dtor, s); return s; } struct rspamd_async_event * rspamd_session_add_event_full(struct rspamd_async_session *session, event_finalizer_t fin, gpointer user_data, const char *subsystem, const char *event_source) { struct rspamd_async_event *new_event; int ret; if (session == NULL) { msg_err("session is NULL"); g_assert_not_reached(); } if (!RSPAMD_SESSION_CAN_ADD_EVENT(session)) { msg_debug_session("skip adding event subsystem: %s: " "session is destroying/cleaning", subsystem); return NULL; } new_event = rspamd_mempool_alloc(session->pool, sizeof(struct rspamd_async_event)); new_event->fin = fin; new_event->user_data = user_data; new_event->subsystem = subsystem; new_event->event_source = event_source; msg_debug_session("added event: %p, pending %d (+1) events, " "subsystem: %s (%s)", user_data, kh_size(session->events), subsystem, event_source); kh_put(rspamd_events_hash, session->events, new_event, &ret); g_assert(ret > 0); return new_event; } void rspamd_session_remove_event_full(struct rspamd_async_session *session, event_finalizer_t fin, void *ud, const char *event_source) { struct rspamd_async_event search_ev, *found_ev; khiter_t k; if (session == NULL) { msg_err("session is NULL"); return; } if (!RSPAMD_SESSION_CAN_ADD_EVENT(session)) { /* Session is already cleaned up, ignore this */ return; } /* Search for event */ search_ev.fin = fin; search_ev.user_data = ud; k = kh_get(rspamd_events_hash, session->events, &search_ev); if (k == kh_end(session->events)) { msg_err_session("cannot find event: %p(%p) from %s (%d total events)", fin, ud, event_source, (int) kh_size(session->events)); kh_foreach_key(session->events, found_ev, { msg_err_session("existing event %s (%s): %p(%p)", found_ev->subsystem, found_ev->event_source, found_ev->fin, found_ev->user_data); }); g_assert_not_reached(); } found_ev = kh_key(session->events, k); msg_debug_session("removed event: %p, pending %d (-1) events, " "subsystem: %s (%s), added at %s", ud, kh_size(session->events), found_ev->subsystem, event_source, found_ev->event_source); kh_del(rspamd_events_hash, session->events, k); /* Remove event */ if (fin) { fin(ud); } rspamd_session_pending(session); } gboolean rspamd_session_destroy(struct rspamd_async_session *session) { if (session == NULL) { msg_err("session is NULL"); return FALSE; } if (!rspamd_session_blocked(session)) { session->flags |= RSPAMD_SESSION_FLAG_DESTROYING; rspamd_session_cleanup(session, false); if (session->cleanup != NULL) { session->cleanup(session->user_data); } } return TRUE; } void rspamd_session_cleanup(struct rspamd_async_session *session, bool forced_cleanup) { struct rspamd_async_event *ev; if (session == NULL) { msg_err("session is NULL"); return; } session->flags |= RSPAMD_SESSION_FLAG_CLEANUP; khash_t(rspamd_events_hash) *uncancellable_events = kh_init(rspamd_events_hash); kh_foreach_key(session->events, ev, { /* Call event's finalizer */ int ret; if (ev->fin != NULL) { if (forced_cleanup) { msg_info_session("forced removed event on destroy: %p, subsystem: %s, scheduled from: %s", ev->user_data, ev->subsystem, ev->event_source); } else { msg_debug_session("removed event on destroy: %p, subsystem: %s", ev->user_data, ev->subsystem); } ev->fin(ev->user_data); } else { if (forced_cleanup) { msg_info_session("NOT forced removed event on destroy - uncancellable: " "%p, subsystem: %s, scheduled from: %s", ev->user_data, ev->subsystem, ev->event_source); } else { msg_debug_session("NOT removed event on destroy - uncancellable: %p, subsystem: %s", ev->user_data, ev->subsystem); } /* Assume an event is uncancellable, move it to a new hash table */ kh_put(rspamd_events_hash, uncancellable_events, ev, &ret); } }); kh_destroy(rspamd_events_hash, session->events); session->events = uncancellable_events; if (forced_cleanup) { msg_info_session("pending %d uncancellable events", kh_size(uncancellable_events)); } else { msg_debug_session("pending %d uncancellable events", kh_size(uncancellable_events)); } session->flags &= ~RSPAMD_SESSION_FLAG_CLEANUP; } gboolean rspamd_session_pending(struct rspamd_async_session *session) { gboolean ret = TRUE; if (kh_size(session->events) == 0) { if (session->fin != NULL) { msg_debug_session("call fin handler, as no events are pending"); if (!session->fin(session->user_data)) { /* Session finished incompletely, perform restoration */ msg_debug_session("restore incomplete session"); if (session->restore != NULL) { session->restore(session->user_data); } } else { ret = FALSE; } } ret = FALSE; } return ret; } unsigned int rspamd_session_events_pending(struct rspamd_async_session *session) { unsigned int npending; g_assert(session != NULL); npending = kh_size(session->events); msg_debug_session("pending %d events", npending); return npending; } rspamd_mempool_t * rspamd_session_mempool(struct rspamd_async_session *session) { g_assert(session != NULL); return session->pool; } gboolean rspamd_session_blocked(struct rspamd_async_session *session) { g_assert(session != NULL); return !RSPAMD_SESSION_CAN_ADD_EVENT(session); }