WIP thunder algo
This commit is contained in:
parent
5fdfd9aa9a
commit
e95a4caabe
1 changed files with 22 additions and 0 deletions
|
@ -5,8 +5,24 @@
|
||||||
#include "proxy.h"
|
#include "proxy.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
|
|
||||||
|
struct thunder_ctx {
|
||||||
|
uint16_t recv_id;
|
||||||
|
uint16_t emit_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
void prepare(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
void prepare(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
||||||
|
struct algo_ctx* app_ctx = fdinfo->cat->app_ctx;
|
||||||
|
struct thunder_ctx* thunderc = app_ctx->misc;
|
||||||
|
|
||||||
|
thunderc->emit_id++;
|
||||||
|
union abstract_packet metadata = {
|
||||||
|
.fmt.headers.cmd = CMD_UDP_METADATA_THUNDER,
|
||||||
|
.fmt.headers.size = sizeof(metadata.fmt.headers) + sizeof(metadata.fmt.content.udp_metadata_thunder),
|
||||||
|
.fmt.headers.flags = 0,
|
||||||
|
.fmt.content.udp_metadata_thunder.id = thunderc->emit_id,
|
||||||
|
.fmt.content.udp_metadata_thunder.deltat = 0
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void pad(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
void pad(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct buffer_packet* bp) {
|
||||||
|
@ -20,6 +36,12 @@ int schedule(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, struct bu
|
||||||
}
|
}
|
||||||
|
|
||||||
void algo_thunder_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, struct algo_params* ap) {
|
void algo_thunder_init(struct evt_core_ctx* ctx, struct algo_ctx* app_ctx, struct algo_params* ap) {
|
||||||
|
app_ctx->misc = malloc(sizeof(struct thunder_ctx));
|
||||||
|
if (app_ctx->misc == NULL) {
|
||||||
|
perror("malloc failed in algo thunder init");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
memset(app_ctx->misc, 0, sizeof(struct thunder_ctx));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue