Minor fixes

This commit is contained in:
Stephen Seo 2020-01-05 15:39:25 +09:00
parent 88ba670ce9
commit e644cd86b1

View file

@ -226,11 +226,10 @@ atostrBufIndex(0),
receivedPkts(), receivedPkts(),
cSendPkts(), cSendPkts(),
rng_engine(), rng_engine(),
conMapMutex() conMapMutex(),
peerPKWhitelistMutex()
{ {
for(unsigned int i = 0; i < UDPC_ATOSTR_SIZE; ++i) { std::memset(atostrBuf, 0, UDPC_ATOSTR_SIZE);
atostrBuf[i] = 0;
}
if(isThreaded) { if(isThreaded) {
flags.set(0); flags.set(0);
@ -484,7 +483,7 @@ void UDPC::Context::update_impl() {
idMap.erase(cIter->second.id); idMap.erase(cIter->second.id);
} }
if(isReceivingEvents.load()) { if(isReceivingEvents.load()) {
if(flags.test(1) && !cIter->second.flags.test(4)) { if(flags.test(1) && cIter->second.flags.test(3)) {
externalEvents.push(UDPC_Event{ externalEvents.push(UDPC_Event{
UDPC_ET_FAIL_CONNECT, *iter, false}); UDPC_ET_FAIL_CONNECT, *iter, false});
} else { } else {
@ -1045,9 +1044,14 @@ void UDPC::Context::update_impl() {
} }
} }
if(isReceivingEvents.load()) { if(isReceivingEvents.load()) {
if(flags.test(1) && iter->second.flags.test(3)) {
externalEvents.push(UDPC_Event{
UDPC_ET_FAIL_CONNECT, iter->first, false});
} else {
externalEvents.push(UDPC_Event{ externalEvents.push(UDPC_Event{
UDPC_ET_DISCONNECTED, iter->first, false}); UDPC_ET_DISCONNECTED, iter->first, false});
} }
}
conMap.erase(iter); conMap.erase(iter);
} }
} }