Skip to content

Commit

Permalink
ATRONIX: Increase the size of even queue as needed until 64K
Browse files Browse the repository at this point in the history
This is needed to handle a large number of simultaneous sockets, because
each socket could potentially have an event in the queue, and limiting
that to 127 is too restrictive.

(cherry picked from commit 0f3a941)
  • Loading branch information
Oldes committed Jan 29, 2019
1 parent 5493bd6 commit 7c8443f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/p-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@

REBREQ *req; //!!! move this global

#define EVENTS_LIMIT 0xFFFF //64k
#define EVENTS_CHUNK 128

/***********************************************************************
**
Expand All @@ -84,7 +86,14 @@ REBREQ *req; //!!! move this global
if (!IS_BLOCK(state)) return 0;

// Append to tail if room:
if (SERIES_FULL(VAL_SERIES(state))) Crash(RP_MAX_EVENTS);
if (SERIES_FULL(VAL_SERIES(state))) {
if (VAL_TAIL(state) > EVENTS_LIMIT) {
Crash(RP_MAX_EVENTS);
} else {
Extend_Series(VAL_SERIES(state), EVENTS_CHUNK);
//RL_Print("event queue increased to :%d\n", SERIES_REST(VAL_SERIES(state)));
}
}
VAL_TAIL(state)++;
value = VAL_BLK_TAIL(state);
SET_END(value);
Expand Down Expand Up @@ -151,7 +160,7 @@ REBREQ *req; //!!! move this global
if (!IS_OBJECT(spec)) Trap1(RE_INVALID_SPEC, spec);

// Get or setup internal state data:
if (!IS_BLOCK(state)) Set_Block(state, Make_Block(127));
if (!IS_BLOCK(state)) Set_Block(state, Make_Block(EVENTS_CHUNK - 1));

switch (action) {

Expand Down

0 comments on commit 7c8443f

Please sign in to comment.