@@ -531,6 +531,9 @@ void CConnectDlg::SetServerList ( const CHostAddress& InetAddr, const CVector<CS
531531 // store host address
532532 pNewListViewItem->setData ( LVC_NAME, Qt::UserRole, CurHostAddress.toString () );
533533
534+ enum EClientFetchMode eFetchMode = CFM_UDP_REQUEST; // start off in UDP mode
535+ pNewListViewItem->setData ( LVC_CLIENTS, Qt::UserRole, eFetchMode ); // initialise fetch mode
536+
534537 // per default expand the list item (if not "show all servers")
535538 if ( bShowAllMusicians )
536539 {
@@ -561,6 +564,26 @@ void CConnectDlg::SetTcpSupported ( const CHostAddress& InetAddr, int iID )
561564 break ;
562565
563566 case PROTMESSID_CLM_CONN_CLIENTS_LIST:
567+ // find the server with the correct address
568+ {
569+ CMappedTreeWidgetItem* pCurListViewItem = FindListViewItem ( InetAddr );
570+
571+ if ( pCurListViewItem )
572+ {
573+ // find the current fetch mode for the client list for this server
574+ enum EClientFetchMode eFetchMode =
575+ static_cast <enum EClientFetchMode> ( pCurListViewItem->data ( LVC_CLIENTS, Qt::UserRole ).toInt () );
576+
577+ if ( eFetchMode == CFM_UDP_REQUEST )
578+ {
579+ // client list not yet received - switch to TCP mode
580+ eFetchMode = CFM_TCP;
581+ pCurListViewItem->setData ( LVC_CLIENTS, Qt::UserRole, eFetchMode ); // remember for future fetches
582+
583+ emit CreateCLServerListReqConnClientsListMes ( InetAddr, true ); // TCP
584+ }
585+ }
586+ }
564587 break ;
565588
566589 default :
@@ -575,6 +598,16 @@ void CConnectDlg::SetConnClientsList ( const CHostAddress& InetAddr, const CVect
575598
576599 if ( pCurListViewItem )
577600 {
601+ // find the current fetch mode for the client list for this server
602+ enum EClientFetchMode eFetchMode = static_cast <enum EClientFetchMode> ( pCurListViewItem->data ( LVC_CLIENTS, Qt::UserRole ).toInt () );
603+
604+ if ( eFetchMode != CFM_TCP )
605+ {
606+ // not switched to TCP mode - set to UDP for successful fetch
607+ eFetchMode = CFM_UDP_RESULT;
608+ pCurListViewItem->setData ( LVC_CLIENTS, Qt::UserRole, eFetchMode );
609+ }
610+
578611 // first remove any existing children
579612 DeleteAllListViewItemChilds ( pCurListViewItem );
580613
@@ -1005,7 +1038,16 @@ void CConnectDlg::SetPingTimeAndNumClientsResult ( const CHostAddress& InetAddr,
10051038 // connected clients, if not then request the client names
10061039 if ( iNumClients != pCurListViewItem->childCount () )
10071040 {
1008- emit CreateCLServerListReqConnClientsListMes ( InetAddr, false ); // UDP
1041+ // find the current fetch mode for the client list for this server
1042+ enum EClientFetchMode eFetchMode = static_cast <enum EClientFetchMode> ( pCurListViewItem->data ( LVC_CLIENTS, Qt::UserRole ).toInt () );
1043+
1044+ if ( eFetchMode != CFM_TCP )
1045+ {
1046+ // not switched to TCP mode - reset for next UDP fetch
1047+ eFetchMode = CFM_UDP_REQUEST;
1048+ pCurListViewItem->setData ( LVC_CLIENTS, Qt::UserRole, eFetchMode );
1049+ }
1050+ emit CreateCLServerListReqConnClientsListMes ( InetAddr, eFetchMode == CFM_TCP ); // UDP or TCP
10091051 }
10101052
10111053 // this is the first time a ping time was received, set item to visible
0 commit comments