Implement option to tune Marinetti for high throughput.

This sets the tcpTUNEIPUSERPOLLCT and tcpTUNEIPRUNQCT tuning parameters to 10 (the maximum) instead of the default of 2. This makes Marinetti process more incoming data at once and significantly increases throughput. (Actually, current versions of Marinetti only seem to use tcpTUNEIPUSERPOLLCT, but we set both for compatibility with any future versions that actually use tcpTUNEIPRUNQCT.)
This commit is contained in:
Stephen Heumann 2016-09-02 19:08:45 -05:00
parent 3f9fadd8cb
commit ec3cbc6748
3 changed files with 61 additions and 4 deletions

View File

@ -66,6 +66,8 @@ static BOOLEAN GetIpid (void);
static BOOLEAN DoVNCHandshaking (void); static BOOLEAN DoVNCHandshaking (void);
static BOOLEAN DoDES (void); static BOOLEAN DoDES (void);
static BOOLEAN FinishVNCHandshaking (void); static BOOLEAN FinishVNCHandshaking (void);
static void TuneMarinetti (void);
static void UnTuneMarinetti (void);
#define buffTypePointer 0x0000 /* For TCPIPReadTCP() */ #define buffTypePointer 0x0000 /* For TCPIPReadTCP() */
#define buffTypeHandle 0x0001 #define buffTypeHandle 0x0001
@ -88,6 +90,8 @@ void DoConnect (void) {
colorTablesComplete = TRUE; colorTablesComplete = TRUE;
CloseConnectStatusWindow(); CloseConnectStatusWindow();
} }
TuneMarinetti();
/* Get server & password */ /* Get server & password */
@ -98,13 +102,13 @@ void DoConnect (void) {
if (ConnectTCPIP() == FALSE) { if (ConnectTCPIP() == FALSE) {
SysBeep(); SysBeep();
AlertWindow(awResource, NULL, noTCPIPConnectionError); AlertWindow(awResource, NULL, noTCPIPConnectionError);
return; goto errorReturn;
} }
if (GetIpid() == FALSE) { if (GetIpid() == FALSE) {
SysBeep(); SysBeep();
AlertWindow(awResource, NULL, badGetIpidError); AlertWindow(awResource, NULL, badGetIpidError);
return; goto errorReturn;
} }
if (DoVNCHandshaking() == FALSE) { if (DoVNCHandshaking() == FALSE) {
@ -115,14 +119,14 @@ void DoConnect (void) {
AlertWindow(awResource, NULL, badHandshakingError); AlertWindow(awResource, NULL, badHandshakingError);
else else
alerted = FALSE; alerted = FALSE;
return; goto errorReturn;
} }
if (FinishVNCHandshaking() == FALSE) { if (FinishVNCHandshaking() == FALSE) {
CloseConnectStatusWindow(); CloseConnectStatusWindow();
InitCursor(); InitCursor();
AlertWindow(awResource, NULL, badOptionNegotiationError); AlertWindow(awResource, NULL, badOptionNegotiationError);
SysBeep(); SysBeep();
return; goto errorReturn;
} }
InitVNCWindow(); InitVNCWindow();
@ -136,6 +140,11 @@ void DoConnect (void) {
myEvent.wmTaskMask = 0x001D79FE; /* don't let TaskMaster process keys */ myEvent.wmTaskMask = 0x001D79FE; /* don't let TaskMaster process keys */
InitMenus(noKB); InitMenus(noKB);
vncConnected = TRUE; vncConnected = TRUE;
return;
errorReturn:
UnTuneMarinetti();
return;
} }
/******************************************************************* /*******************************************************************
@ -704,6 +713,49 @@ static BOOLEAN FinishVNCHandshaking (void) {
} }
/* Marinetti tuning structures */
static tuneStruct oldTune;
static tuneStruct newTune;
/**********************************************************************
* TuneMarinetti() - Set Marinetti tuning options for max throughput
**********************************************************************/
void TuneMarinetti (void) {
if (tuneMarinetti) {
TCPIPGetTuningTable(&oldTune);
/* Tune to process max number of datagrams each time polled */
newTune.tcpTUNECOUNT = 10;
newTune.tcpTUNEIPUSERPOLLCT = 10;
newTune.tcpTUNEIPRUNQFREQ = oldTune.tcpTUNEIPRUNQFREQ;
newTune.tcpTUNEIPRUNQCT = 10;
newTune.tcpTUNETCPUSERPOLL = oldTune.tcpTUNETCPUSERPOLL;
TCPIPSetTuningTable(&newTune);
}
}
/**********************************************************************
* UnTuneMarinetti() - Set Marinetti tuning options back to old values
**********************************************************************/
void UnTuneMarinetti (void) {
tuneStruct currentTune;
if (tuneMarinetti) {
TCPIPGetTuningTable(&currentTune);
/* Restore original tuning table unless something else seems to have
* modified it in the meantime.
*/
if ( currentTune.tcpTUNEIPUSERPOLLCT == newTune.tcpTUNEIPUSERPOLLCT
&& currentTune.tcpTUNEIPRUNQFREQ == newTune.tcpTUNEIPRUNQFREQ
&& currentTune.tcpTUNEIPRUNQCT == newTune.tcpTUNEIPRUNQCT
&& currentTune.tcpTUNETCPUSERPOLL == newTune.tcpTUNETCPUSERPOLL)
{
TCPIPSetTuningTable(&oldTune);
}
}
}
/********************************************************************** /**********************************************************************
* CloseTCPConnection() - Close the TCP connection to the host * CloseTCPConnection() - Close the TCP connection to the host
**********************************************************************/ **********************************************************************/
@ -716,5 +768,6 @@ void CloseTCPConnection (void) {
TCPIPLogout(hostIpid); TCPIPLogout(hostIpid);
} while (toolerror() == terrSOCKETOPEN); } while (toolerror() == terrSOCKETOPEN);
CloseConnectStatusWindow(); CloseConnectStatusWindow();
UnTuneMarinetti();
InitCursor(); InitCursor();
} }

View File

@ -87,6 +87,7 @@ BOOLEAN allowClipboardTransfers = TRUE;
BOOLEAN emulate3ButtonMouse = TRUE; BOOLEAN emulate3ButtonMouse = TRUE;
BOOLEAN viewOnlyMode = FALSE; BOOLEAN viewOnlyMode = FALSE;
BOOLEAN useHextile = FALSE; BOOLEAN useHextile = FALSE;
BOOLEAN tuneMarinetti = TRUE;
char vncServer[257]; char vncServer[257];
char vncPassword[10]; char vncPassword[10];
@ -238,6 +239,8 @@ static void HandleControl (void) {
break; break;
case chkEmul3Btn: emulate3ButtonMouse = !emulate3ButtonMouse; break; case chkEmul3Btn: emulate3ButtonMouse = !emulate3ButtonMouse; break;
case chkViewOnly: viewOnlyMode = !viewOnlyMode; break; case chkViewOnly: viewOnlyMode = !viewOnlyMode; break;
case chkTuneMarinetti:
tuneMarinetti = !tuneMarinetti; break;
case txtTransfers: allowClipboardTransfers = !allowClipboardTransfers; case txtTransfers: allowClipboardTransfers = !allowClipboardTransfers;
SetCtlValueByID(allowClipboardTransfers, SetCtlValueByID(allowClipboardTransfers,
newConnWindow, chkClipboard); break; newConnWindow, chkClipboard); break;

View File

@ -15,6 +15,7 @@ extern BOOLEAN allowClipboardTransfers;
extern BOOLEAN emulate3ButtonMouse; extern BOOLEAN emulate3ButtonMouse;
extern BOOLEAN viewOnlyMode; extern BOOLEAN viewOnlyMode;
extern BOOLEAN useHextile; extern BOOLEAN useHextile;
extern BOOLEAN tuneMarinetti;
extern char vncServer[257]; extern char vncServer[257];
extern char vncPassword[10]; extern char vncPassword[10];