9
9
#define NAME "bandwidth"
10
10
#define BANDWIDTH_MIN "0"
11
11
#define BANDWIDTH_MAX "99999"
12
+ #define BANDWIDTH_DEFAULT 10
12
13
13
14
//---------------------------------------------------------------------
14
15
// rate stats
@@ -47,7 +48,7 @@ static Ihandle *inboundCheckbox, *outboundCheckbox, *bandwidthInput;
47
48
static volatile short bandwidthEnabled = 0 ,
48
49
bandwidthInbound = 1 , bandwidthOutbound = 1 ;
49
50
50
- static volatile LONG bandwidthLimit = 0 ;
51
+ static volatile LONG bandwidthLimit = BANDWIDTH_DEFAULT ;
51
52
static CRateStats * rateStats = NULL ;
52
53
53
54
@@ -61,7 +62,7 @@ static Ihandle* bandwidthSetupUI() {
61
62
);
62
63
63
64
IupSetAttribute (bandwidthInput , "VISIBLECOLUMNS" , "4" );
64
- IupSetAttribute (bandwidthInput , "VALUE" , "0" );
65
+ IupSetAttribute (bandwidthInput , "VALUE" , STR ( BANDWIDTH_DEFAULT ) );
65
66
IupSetCallback (bandwidthInput , "VALUECHANGED_CB" , uiSyncInt32 );
66
67
IupSetAttribute (bandwidthInput , SYNCED_VALUE , (char * )& bandwidthLimit );
67
68
IupSetAttribute (bandwidthInput , INTEGER_MAX , BANDWIDTH_MAX );
@@ -107,7 +108,8 @@ static short bandwidthProcess(PacketNode *head, PacketNode* tail) {
107
108
DWORD now_ts = timeGetTime ();
108
109
int limit = bandwidthLimit * 1024 ;
109
110
110
- if (limit <= 0 || rateStats == NULL ) {
111
+ // allow 0 limit which should drop all
112
+ if (limit < 0 || rateStats == NULL ) {
111
113
return 0 ;
112
114
}
113
115
0 commit comments