do not reinitialized network

pull/753/head
Ömer Şiar Baysal 5 months ago
parent 19908839d8
commit 3e77f72a7a
  1. 33
      src/minidexed.cpp
  2. 1
      src/minidexed.h

@ -32,6 +32,7 @@ const char WLANFirmwarePath[] = "SD:firmware/";
const char WLANConfigFile[] = "SD:wpa_supplicant.conf"; const char WLANConfigFile[] = "SD:wpa_supplicant.conf";
#define FTPUSERNAME "admin" #define FTPUSERNAME "admin"
#define FTPPASSWORD "admin" #define FTPPASSWORD "admin"
#define MDNSSERVICENAME "MiniDexed"
LOGMODULE ("minidexed"); LOGMODULE ("minidexed");
@ -61,6 +62,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_WPASupplicant(WLANConfigFile), m_WPASupplicant(WLANConfigFile),
m_bNetworkReady(false), m_bNetworkReady(false),
m_UDPMIDI (this, pConfig, &m_UI), m_UDPMIDI (this, pConfig, &m_UI),
m_pmDNSPublisher (),
m_bSavePerformance (false), m_bSavePerformance (false),
m_bSavePerformanceNewFile (false), m_bSavePerformanceNewFile (false),
m_bSetNewPerformance (false), m_bSetNewPerformance (false),
@ -1826,10 +1828,14 @@ void CMiniDexed::UpdateNetwork()
if (!m_pNet) if (!m_pNet)
return; return;
//add wired network check as well
bool bNetIsRunning = m_pNet->IsRunning(); bool bNetIsRunning = m_pNet->IsRunning();
bNetIsRunning &= m_WPASupplicant.IsConnected(); if ((strcmp(m_pConfig->GetNetworkType(), "ethernet") == 0))
bNetIsRunning &= m_pNetDevice->IsLinkUp();
if (!m_bNetworkReady && bNetIsRunning) else if ((strcmp(m_pConfig->GetNetworkType(), "wifi") == 0))
bNetIsRunning &= m_WPASupplicant.IsConnected();
if (!m_bNetworkReady && (m_pNet->IsRunning()))
{ {
m_bNetworkReady = true; m_bNetworkReady = true;
CString IPString; CString IPString;
@ -1837,7 +1843,6 @@ void CMiniDexed::UpdateNetwork()
//LOGNOTE("Network up and running at: %s", static_cast<const char *>(IPString)); //LOGNOTE("Network up and running at: %s", static_cast<const char *>(IPString));
m_UDPMIDI.Initialize(); m_UDPMIDI.Initialize();
m_pFTPDaemon = new CFTPDaemon(FTPUSERNAME, FTPPASSWORD); m_pFTPDaemon = new CFTPDaemon(FTPUSERNAME, FTPPASSWORD);
@ -1855,21 +1860,25 @@ void CMiniDexed::UpdateNetwork()
m_UI.DisplayWrite ("IP", "Network", IPString, 0, 1); m_UI.DisplayWrite ("IP", "Network", IPString, 0, 1);
CmDNSPublisher *pmDNSPublisher = new CmDNSPublisher (m_pNet); m_pmDNSPublisher = new CmDNSPublisher (m_pNet);
assert (pmDNSPublisher); assert (m_pmDNSPublisher);
static const char ServiceName[] = "minidexed-rtpmidi";
static const char *ppText[] = {"RTP-MIDI Receiver", nullptr}; // TXT record strings //static const char *ppText[] = {"RTP-MIDI Receiver", nullptr}; // dont bother adding additional data
if (!pmDNSPublisher->PublishService (ServiceName, CmDNSPublisher::ServiceTypeAppleMIDI, if (!m_pmDNSPublisher->PublishService (MDNSSERVICENAME, CmDNSPublisher::ServiceTypeAppleMIDI,
5004, ppText)) 5004))
{ {
LOGPANIC ("Cannot publish mdns service"); LOGPANIC ("Cannot publish mdns service");
} }
} }
else if (m_bNetworkReady && !bNetIsRunning) else if (m_bNetworkReady && !bNetIsRunning)
{ {
m_bNetworkReady = false; //m_bNetworkReady = false;
m_pmDNSPublisher->UnpublishService (MDNSSERVICENAME);
LOGNOTE("Network disconnected."); LOGNOTE("Network disconnected.");
}
else if (m_bNetworkReady && bNetIsRunning)
{
LOGNOTE("Network connection reestablished.");
} }
} }

@ -318,6 +318,7 @@ private:
bool m_bNetworkReady; bool m_bNetworkReady;
CUDPMIDIDevice m_UDPMIDI; CUDPMIDIDevice m_UDPMIDI;
CFTPDaemon* m_pFTPDaemon; CFTPDaemon* m_pFTPDaemon;
CmDNSPublisher *m_pmDNSPublisher;
bool m_bSavePerformance; bool m_bSavePerformance;
bool m_bSavePerformanceNewFile; bool m_bSavePerformanceNewFile;

Loading…
Cancel
Save