diff --git a/src/UDPConnection.cpp b/src/UDPConnection.cpp index 15ec54f..73a8fe8 100644 --- a/src/UDPConnection.cpp +++ b/src/UDPConnection.cpp @@ -478,8 +478,13 @@ void UDPC::Context::update_impl() { idMap.erase(cIter->second.id); } if(isReceivingEvents.load()) { - externalEvents.push(UDPC_Event{ - UDPC_ET_DISCONNECTED, *iter, false}); + if(flags.test(1) && !cIter->second.flags.test(4)) { + externalEvents.push(UDPC_Event{ + UDPC_ET_FAIL_CONNECT, *iter, false}); + } else { + externalEvents.push(UDPC_Event{ + UDPC_ET_DISCONNECTED, *iter, false}); + } } conMap.erase(cIter); diff --git a/src/UDPConnection.h b/src/UDPConnection.h index 290365d..f516dd7 100644 --- a/src/UDPConnection.h +++ b/src/UDPConnection.h @@ -195,6 +195,7 @@ typedef enum { UDPC_ET_REQUEST_DISCONNECT, UDPC_ET_CONNECTED, UDPC_ET_DISCONNECTED, + UDPC_ET_FAIL_CONNECT, UDPC_ET_GOOD_MODE, UDPC_ET_BAD_MODE } UDPC_EventType; diff --git a/src/test/UDPC_NetworkTest.c b/src/test/UDPC_NetworkTest.c index 0a64070..3f072cc 100644 --- a/src/test/UDPC_NetworkTest.c +++ b/src/test/UDPC_NetworkTest.c @@ -324,6 +324,9 @@ int main(int argc, char **argv) { case UDPC_ET_DISCONNECTED: typeString = "DISCONNECTED"; break; + case UDPC_ET_FAIL_CONNECT: + typeString = "FAIL_CONNECT"; + break; case UDPC_ET_GOOD_MODE: typeString = "GOOD_MODE"; break;