--- linuxsampler/trunk/src/network/lscpserver.cpp 2005/10/26 09:34:38 793 +++ linuxsampler/trunk/src/network/lscpserver.cpp 2006/03/04 16:23:53 841 @@ -146,9 +146,13 @@ //Now let's deliver late notifies (if any) NotifyBufferMutex.Lock(); for (std::map::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { +#ifdef MSG_NOSIGNAL send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); - bufferedNotifies.erase(iterNotify); +#else + send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), 0); +#endif } + bufferedNotifies.clear(); NotifyBufferMutex.Unlock(); fd_set selectSet = fdSet; @@ -262,7 +266,11 @@ while (true) { if (NotifyMutex.Trylock()) { for(;iter != end; iter++) +#ifdef MSG_NOSIGNAL send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL); +#else + send(*iter, notify.c_str(), notify.size(), 0); +#endif NotifyMutex.Unlock(); break; } else { @@ -371,7 +379,11 @@ dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str())); if (currentSocket != -1) { NotifyMutex.Lock(); +#ifdef MSG_NOSIGNAL send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL); +#else + send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), 0); +#endif NotifyMutex.Unlock(); } } @@ -552,7 +564,9 @@ */ String LSCPServer::AddChannel() { dmsg(2,("LSCPServer: AddChannel()\n")); + LockRTNotify(); SamplerChannel* pSamplerChannel = pSampler->AddSamplerChannel(); + UnlockRTNotify(); LSCPResultSet result(pSamplerChannel->Index()); return result.Produce(); } @@ -594,6 +608,7 @@ String LSCPServer::GetEngineInfo(String EngineName) { dmsg(2,("LSCPServer: GetEngineInfo(EngineName=%s)\n", EngineName.c_str())); LSCPResultSet result; + LockRTNotify(); try { Engine* pEngine = EngineFactory::Create(EngineName); result.Add("DESCRIPTION", pEngine->Description()); @@ -603,6 +618,7 @@ catch (LinuxSamplerException e) { result.Error(e); } + UnlockRTNotify(); return result.Produce(); } @@ -1233,6 +1249,7 @@ String LSCPServer::SetAudioOutputDevice(uint AudioDeviceId, uint uiSamplerChannel) { dmsg(2,("LSCPServer: SetAudiotOutputDevice(AudioDeviceId=%d, SamplerChannel=%d)\n",AudioDeviceId,uiSamplerChannel)); LSCPResultSet result; + LockRTNotify(); try { SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); @@ -1244,12 +1261,14 @@ catch (LinuxSamplerException e) { result.Error(e); } + UnlockRTNotify(); return result.Produce(); } String LSCPServer::SetAudioOutputType(String AudioOutputDriver, uint uiSamplerChannel) { dmsg(2,("LSCPServer: SetAudioOutputType(String AudioOutputDriver=%s, SamplerChannel=%d)\n",AudioOutputDriver.c_str(),uiSamplerChannel)); LSCPResultSet result; + LockRTNotify(); try { SamplerChannel* pSamplerChannel = pSampler->GetSamplerChannel(uiSamplerChannel); if (!pSamplerChannel) throw LinuxSamplerException("Invalid sampler channel number " + ToString(uiSamplerChannel)); @@ -1281,6 +1300,7 @@ catch (LinuxSamplerException e) { result.Error(e); } + UnlockRTNotify(); return result.Produce(); }