fix the MAX_SIZE_BYTES_NETW_BUF, change the --showallservers to include the server list index and do not sort by ping

This commit is contained in:
Volker Fischer 2020-04-01 21:16:44 +02:00
parent a531bc4a0b
commit ee48000b34
3 changed files with 28 additions and 27 deletions

View file

@ -10,10 +10,6 @@
- changed the maximum number of clients supported by the server from 20 to 50
TODO for the 64 samples version check the audio quality stereo/high for bandwidth (less high frequencies as with 128 samples and stereo/high)
TODO revise MAX_SIZE_BYTES_NETW_BUF value -> PROTMESSID_CLM_SERVER_LIST with 200 servers may exceed the network limit

View file

@ -238,6 +238,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
// the central server, we have to use the receive host address
// instead
CHostAddress CurHostAddress;
if ( iIdx > 0 )
{
CurHostAddress = vecServerInfo[iIdx].HostAddr;
@ -271,17 +272,21 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
if ( vecServerInfo[iIdx].HostAddr.iPort == LLCON_DEFAULT_PORT_NUMBER )
{
// only show IP number, no port number
pNewListViewItem->setText ( 0, CurHostAddress.
toString ( CHostAddress::SM_IP_NO_LAST_BYTE ) );
pNewListViewItem->setText ( 0, CurHostAddress.toString ( CHostAddress::SM_IP_NO_LAST_BYTE ) );
}
else
{
// show IP number and port
pNewListViewItem->setText ( 0, CurHostAddress.
toString ( CHostAddress::SM_IP_NO_LAST_BYTE_PORT ) );
pNewListViewItem->setText ( 0, CurHostAddress.toString ( CHostAddress::SM_IP_NO_LAST_BYTE_PORT ) );
}
}
// in case of all servers shown, add the registration number at the beginning
if ( bShowCompleteRegList )
{
pNewListViewItem->setText ( 0, QString ( "%1: " ).arg ( iIdx ) + pNewListViewItem->text ( 0 ) );
}
// show server name in bold font if it is a permanent server
QFont CurServerNameFont = pNewListViewItem->font ( 0 );
CurServerNameFont.setBold ( vecServerInfo[iIdx].bPermanentOnline );
@ -294,6 +299,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
// server location (city and country)
QString strLocation = vecServerInfo[iIdx].strCity;
if ( ( !strLocation.isEmpty() ) &&
( vecServerInfo[iIdx].eCountry != QLocale::AnyCountry ) )
{
@ -301,8 +307,7 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr,
}
if ( vecServerInfo[iIdx].eCountry != QLocale::AnyCountry )
{
strLocation +=
QLocale::countryToString ( vecServerInfo[iIdx].eCountry );
strLocation += QLocale::countryToString ( vecServerInfo[iIdx].eCountry );
}
// for debugging, plot address infos in connect dialog
@ -326,8 +331,7 @@ strLocation += ", " + vecServerInfo[iIdx].HostAddr.InetAddr.toString() +
pNewListViewItem->setText ( 6, QString().setNum ( 0 ) );
// store host address
pNewListViewItem->setData ( 0, Qt::UserRole,
CurHostAddress.toString() );
pNewListViewItem->setData ( 0, Qt::UserRole, CurHostAddress.toString() );
}
// immediately issue the ping measurements and start the ping timer since
@ -409,8 +413,11 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr,
// add the new child to the corresponding server item
pCurListViewItem->addChild ( pNewChildListViewItem );
// per default expand the list item
lvwServers->expandItem ( pCurListViewItem );
// per default expand the list item (if not "show all servers")
if ( !bShowCompleteRegList )
{
lvwServers->expandItem ( pCurListViewItem );
}
// at least one server has childs now, show decoration to be able
// to show the childs
@ -596,7 +603,10 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( CHostAddress&
// Update the sorting (lowest number on top).
// Note that the sorting must be the last action for the current
// item since the topLevelItem ( iIdx ) is then no longer valid.
lvwServers->sortByColumn ( 4, Qt::AscendingOrder );
if ( !bShowCompleteRegList ) // do not sort if "show all servers"
{
lvwServers->sortByColumn ( 4, Qt::AscendingOrder );
}
}
}

View file

@ -136,17 +136,11 @@ LED bar: lbr
// gets in trouble if the value is too low)
#define CELT_MINIMUM_NUM_BYTES 10
// define the maximum mono audio buffer size at a sample rate
// of 48 kHz, this is important for defining the maximum number
// of bytes to be expected from the network interface
// TODO check why this number is so large...?
#define MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ 4096
// Maximum block size for network input buffer. Consider a maximum sample rate
// of 48 kHz and two audio channels and two bytes per sample.
#define MAX_SIZE_BYTES_NETW_BUF ( MAX_MONO_AUD_BUFF_SIZE_AT_48KHZ * 4 )
// Maximum block size for network input buffer. It is defined by the longest
// protocol message which is PROTMESSID_CLM_SERVER_LIST: Worst case:
// (2+2+1+2+2)+200*(4+2+2+1+1+2+20+2+32+2+20)=17609
// We add some headroom to that value.
#define MAX_SIZE_BYTES_NETW_BUF 20000
// minimum/maximum network buffer size (which can be chosen by slider)
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks
@ -191,7 +185,8 @@ LED bar: lbr
// without any other changes in the code
#define DEFAULT_USED_NUM_CHANNELS 10 // default used number channels for server
// maximum number of servers registered in the server list
// Maximum number of servers registered in the server list. If you want to
// change this parameter, you most probably have to adjust MAX_SIZE_BYTES_NETW_BUF.
#define MAX_NUM_SERVERS_IN_SERVER_LIST 200
// defines the time interval at which the ping time is updated in the GUI