Skip to content

Commit ce1a98f

Browse files
committed
bandwidth default; allow 0 bandwith
1 parent d9d4b74 commit ce1a98f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/bandwidth.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#define NAME "bandwidth"
1010
#define BANDWIDTH_MIN "0"
1111
#define BANDWIDTH_MAX "99999"
12+
#define BANDWIDTH_DEFAULT 10
1213

1314
//---------------------------------------------------------------------
1415
// rate stats
@@ -47,7 +48,7 @@ static Ihandle *inboundCheckbox, *outboundCheckbox, *bandwidthInput;
4748
static volatile short bandwidthEnabled = 0,
4849
bandwidthInbound = 1, bandwidthOutbound = 1;
4950

50-
static volatile LONG bandwidthLimit = 0;
51+
static volatile LONG bandwidthLimit = BANDWIDTH_DEFAULT;
5152
static CRateStats *rateStats = NULL;
5253

5354

@@ -61,7 +62,7 @@ static Ihandle* bandwidthSetupUI() {
6162
);
6263

6364
IupSetAttribute(bandwidthInput, "VISIBLECOLUMNS", "4");
64-
IupSetAttribute(bandwidthInput, "VALUE", "0");
65+
IupSetAttribute(bandwidthInput, "VALUE", STR(BANDWIDTH_DEFAULT));
6566
IupSetCallback(bandwidthInput, "VALUECHANGED_CB", uiSyncInt32);
6667
IupSetAttribute(bandwidthInput, SYNCED_VALUE, (char*)&bandwidthLimit);
6768
IupSetAttribute(bandwidthInput, INTEGER_MAX, BANDWIDTH_MAX);
@@ -107,7 +108,8 @@ static short bandwidthProcess(PacketNode *head, PacketNode* tail) {
107108
DWORD now_ts = timeGetTime();
108109
int limit = bandwidthLimit * 1024;
109110

110-
if (limit <= 0 || rateStats == NULL) {
111+
// allow 0 limit which should drop all
112+
if (limit < 0 || rateStats == NULL) {
111113
return 0;
112114
}
113115

src/common.h

-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ extern Module oodModule;
145145
extern Module dupModule;
146146
extern Module tamperModule;
147147
extern Module resetModule;
148-
extern Module capModule;
149148
extern Module bandwidthModule;
150149
extern Module* modules[MODULE_CNT]; // all modules in a list
151150

src/main.c

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ Module* modules[MODULE_CNT] = {
1616
&tamperModule,
1717
&resetModule,
1818
&bandwidthModule,
19-
//&capModule
2019
};
2120

2221
volatile short sendState = SEND_STATUS_NONE;

0 commit comments

Comments
 (0)