146 |
//Now let's deliver late notifies (if any) |
//Now let's deliver late notifies (if any) |
147 |
NotifyBufferMutex.Lock(); |
NotifyBufferMutex.Lock(); |
148 |
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
for (std::map<int,String>::iterator iterNotify = bufferedNotifies.begin(); iterNotify != bufferedNotifies.end(); iterNotify++) { |
149 |
|
#ifdef MSG_NOSIGNAL |
150 |
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); |
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), MSG_NOSIGNAL); |
151 |
|
#else |
152 |
|
send(iterNotify->first, iterNotify->second.c_str(), iterNotify->second.size(), 0); |
153 |
|
#endif |
154 |
bufferedNotifies.erase(iterNotify); |
bufferedNotifies.erase(iterNotify); |
155 |
} |
} |
156 |
NotifyBufferMutex.Unlock(); |
NotifyBufferMutex.Unlock(); |
266 |
while (true) { |
while (true) { |
267 |
if (NotifyMutex.Trylock()) { |
if (NotifyMutex.Trylock()) { |
268 |
for(;iter != end; iter++) |
for(;iter != end; iter++) |
269 |
|
#ifdef MSG_NOSIGNAL |
270 |
send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL); |
send(*iter, notify.c_str(), notify.size(), MSG_NOSIGNAL); |
271 |
|
#else |
272 |
|
send(*iter, notify.c_str(), notify.size(), 0); |
273 |
|
#endif |
274 |
NotifyMutex.Unlock(); |
NotifyMutex.Unlock(); |
275 |
break; |
break; |
276 |
} else { |
} else { |
379 |
dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str())); |
dmsg(2,("LSCPServer::AnswerClient(ReturnMessage=%s)", ReturnMessage.c_str())); |
380 |
if (currentSocket != -1) { |
if (currentSocket != -1) { |
381 |
NotifyMutex.Lock(); |
NotifyMutex.Lock(); |
382 |
|
#ifdef MSG_NOSIGNAL |
383 |
send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL); |
send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), MSG_NOSIGNAL); |
384 |
|
#else |
385 |
|
send(currentSocket, ReturnMessage.c_str(), ReturnMessage.size(), 0); |
386 |
|
#endif |
387 |
NotifyMutex.Unlock(); |
NotifyMutex.Unlock(); |
388 |
} |
} |
389 |
} |
} |