Client on connect fail now returns FAIL_CONNECT

Previously, returned event was DISCONNECT. FAIL_CONNECT is a new event
enum value.
This commit is contained in:
Stephen Seo 2020-01-05 14:49:37 +09:00
parent 3ade637205
commit 7996bd5c36
3 changed files with 11 additions and 2 deletions

View file

@ -478,9 +478,14 @@ 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)) {
externalEvents.push(UDPC_Event{
UDPC_ET_FAIL_CONNECT, *iter, false});
} else {
externalEvents.push(UDPC_Event{ externalEvents.push(UDPC_Event{
UDPC_ET_DISCONNECTED, *iter, false}); UDPC_ET_DISCONNECTED, *iter, false});
} }
}
conMap.erase(cIter); conMap.erase(cIter);
} }

View file

@ -195,6 +195,7 @@ typedef enum {
UDPC_ET_REQUEST_DISCONNECT, UDPC_ET_REQUEST_DISCONNECT,
UDPC_ET_CONNECTED, UDPC_ET_CONNECTED,
UDPC_ET_DISCONNECTED, UDPC_ET_DISCONNECTED,
UDPC_ET_FAIL_CONNECT,
UDPC_ET_GOOD_MODE, UDPC_ET_GOOD_MODE,
UDPC_ET_BAD_MODE UDPC_ET_BAD_MODE
} UDPC_EventType; } UDPC_EventType;

View file

@ -324,6 +324,9 @@ int main(int argc, char **argv) {
case UDPC_ET_DISCONNECTED: case UDPC_ET_DISCONNECTED:
typeString = "DISCONNECTED"; typeString = "DISCONNECTED";
break; break;
case UDPC_ET_FAIL_CONNECT:
typeString = "FAIL_CONNECT";
break;
case UDPC_ET_GOOD_MODE: case UDPC_ET_GOOD_MODE:
typeString = "GOOD_MODE"; typeString = "GOOD_MODE";
break; break;