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

View file

@ -136,17 +136,11 @@ LED bar: lbr
// gets in trouble if the value is too low) // gets in trouble if the value is too low)
#define CELT_MINIMUM_NUM_BYTES 10 #define CELT_MINIMUM_NUM_BYTES 10
// define the maximum mono audio buffer size at a sample rate // Maximum block size for network input buffer. It is defined by the longest
// of 48 kHz, this is important for defining the maximum number // protocol message which is PROTMESSID_CLM_SERVER_LIST: Worst case:
// of bytes to be expected from the network interface // (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.
// TODO check why this number is so large...? #define MAX_SIZE_BYTES_NETW_BUF 20000
#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 )
// minimum/maximum network buffer size (which can be chosen by slider) // minimum/maximum network buffer size (which can be chosen by slider)
#define MIN_NET_BUF_SIZE_NUM_BL 1 // number of blocks #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 // without any other changes in the code
#define DEFAULT_USED_NUM_CHANNELS 10 // default used number channels for server #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 #define MAX_NUM_SERVERS_IN_SERVER_LIST 200
// defines the time interval at which the ping time is updated in the GUI // defines the time interval at which the ping time is updated in the GUI