mirror of
https://github.com/openappsec/attachment.git
synced 2026-01-17 16:00:26 +03:00
Implement isNanoQueueEmpty, fixed syntax bug in NanoAsyncRemoveResponse.
This commit is contained in:
@@ -97,6 +97,7 @@ InitNanoAttachment(uint8_t attachment_type, int worker_id, int num_of_workers, i
|
|||||||
attachment->inspection_mode = NON_BLOCKING_THREAD;
|
attachment->inspection_mode = NON_BLOCKING_THREAD;
|
||||||
attachment->num_of_nano_ipc_elements = 200;
|
attachment->num_of_nano_ipc_elements = 200;
|
||||||
attachment->keep_alive_interval_msec = DEFAULT_KEEP_ALIVE_INTERVAL_MSEC;
|
attachment->keep_alive_interval_msec = DEFAULT_KEEP_ALIVE_INTERVAL_MSEC;
|
||||||
|
memset(attachment->async_buckets, 0, sizeof(attachment->async_buckets));
|
||||||
|
|
||||||
if (nano_attachment_init_process(attachment) != NANO_OK) {
|
if (nano_attachment_init_process(attachment) != NANO_OK) {
|
||||||
write_dbg(attachment, 0, DBG_LEVEL_WARNING, "Could not initialize nano attachment");
|
write_dbg(attachment, 0, DBG_LEVEL_WARNING, "Could not initialize nano attachment");
|
||||||
@@ -271,12 +272,13 @@ SendDataNanoAttachmentAsync(NanoAttachment *attachment, AttachmentData *data)
|
|||||||
return NANO_OK;
|
return NANO_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement
|
|
||||||
// Check if the queue is empty, return true if yes - otherwise false.
|
|
||||||
bool
|
bool
|
||||||
isNanoQueueEmpty(NanoAttachment *attachment)
|
isNanoQueueEmpty(NanoAttachment *attachment)
|
||||||
{
|
{
|
||||||
return false;
|
if (attachment == NULL || attachment->nano_service_ipc == NULL) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !isDataAvailable(attachment->nano_service_ipc);
|
||||||
}
|
}
|
||||||
|
|
||||||
SessionID
|
SessionID
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "nano_attachment_bucket.h"
|
#include "nano_attachment_bucket.h"
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define CP_ASYNC_CTX_BUCKETS 2048 ///< Hash table buckets for better distribution
|
#define CP_ASYNC_CTX_BUCKETS 2048 ///< Hash table buckets for better distribution
|
||||||
|
|
||||||
///
|
///
|
||||||
@@ -49,9 +51,7 @@ NanoAsyncAddResponse(NanoAttachment *attachment, SessionID session_id, Attachmen
|
|||||||
void
|
void
|
||||||
NanoAsyncRemoveResponse(NanoAttachment *attachment, SessionID session_id)
|
NanoAsyncRemoveResponse(NanoAttachment *attachment, SessionID session_id)
|
||||||
{
|
{
|
||||||
uint bucket = nano_attachment_async_ctx_hash(ctx->session_id);
|
uint bucket = nano_attachment_async_ctx_hash(session_id);
|
||||||
attachment->async_buckets[bucket]->session_id = 0;
|
memset(&attachment->async_buckets[bucket], 0, sizeof(AttachmentVerdictResponse));
|
||||||
attachment->async_buckets[bucket]->verdict = ATTACHMENT_VERDICT_INSPECT;
|
attachment->async_buckets[bucket].verdict = ATTACHMENT_VERDICT_INSPECT;
|
||||||
attachment->async_buckets[bucket]->modifications = NULL;
|
|
||||||
attachment->async_buckets[bucket]->web_response_data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user