Skip to content

Commit 7c8443f

Browse files
committed
ATRONIX: Increase the size of even queue as needed until 64K
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)
1 parent 5493bd6 commit 7c8443f

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/core/p-event.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858

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

61+
#define EVENTS_LIMIT 0xFFFF //64k
62+
#define EVENTS_CHUNK 128
6163

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

8688
// Append to tail if room:
87-
if (SERIES_FULL(VAL_SERIES(state))) Crash(RP_MAX_EVENTS);
89+
if (SERIES_FULL(VAL_SERIES(state))) {
90+
if (VAL_TAIL(state) > EVENTS_LIMIT) {
91+
Crash(RP_MAX_EVENTS);
92+
} else {
93+
Extend_Series(VAL_SERIES(state), EVENTS_CHUNK);
94+
//RL_Print("event queue increased to :%d\n", SERIES_REST(VAL_SERIES(state)));
95+
}
96+
}
8897
VAL_TAIL(state)++;
8998
value = VAL_BLK_TAIL(state);
9099
SET_END(value);
@@ -151,7 +160,7 @@ REBREQ *req; //!!! move this global
151160
if (!IS_OBJECT(spec)) Trap1(RE_INVALID_SPEC, spec);
152161

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

156165
switch (action) {
157166

0 commit comments

Comments
 (0)