|
|
|
|
@ -38,6 +38,7 @@ struct STREAM_HANDLE {
|
|
|
|
|
struct stream_service *service; |
|
|
|
|
struct stream_session *session; |
|
|
|
|
int publisher; |
|
|
|
|
int selection_owned; |
|
|
|
|
int reason; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
@ -634,8 +635,8 @@ int stream_local_get(struct UTUN_INSTANCE *inst, const struct stream_descriptor
|
|
|
|
|
|
|
|
|
|
/* Выданный локальный handle проверяется до создания сетевых ресурсов. */ |
|
|
|
|
int stream_handle_context(struct STREAM_HANDLE *h, struct UTUN_INSTANCE **inst, struct stream_descriptor *d) { |
|
|
|
|
if (!inst || !d || !stream_handle_active(h) || h->session->source) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "network receive requires active reader handle"); return STREAM_ERR_STATE; |
|
|
|
|
if (!inst || !d || !stream_handle_active(h) || h->session->source || (h->session->optimizer && !h->selection_owned)) { |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_STREAM, "network receive requires active manual reader or internal selector handle"); return STREAM_ERR_STATE; |
|
|
|
|
} |
|
|
|
|
*inst = h->service->inst; *d = h->session->descriptor; return STREAM_OK; |
|
|
|
|
} |
|
|
|
|
@ -696,7 +697,7 @@ void stream_optimizers_tick(struct UTUN_INSTANCE *inst, uint64_t now_ms) {
|
|
|
|
|
if (!service || service->stopping) return; |
|
|
|
|
for (struct stream_session *s = service->sessions; s; s = s->next) { |
|
|
|
|
if (!s->optimizer || s->closing || s->invalidated) continue; |
|
|
|
|
struct STREAM_HANDLE subscription = {.service = service, .session = s}; |
|
|
|
|
struct STREAM_HANDLE subscription = {.service = service, .session = s, .selection_owned = 1}; |
|
|
|
|
stream_optimizer_tick(s->optimizer, &subscription, now_ms); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|