From 2d0def329d3b39cd9e696bd622c1370289aa6528 Mon Sep 17 00:00:00 2001 From: "PSp..om" Date: Fri, 16 Dec 2011 08:30:42 +0000 Subject: [PATCH] Made the UDP disconnect events more timely by including the same bump logic that the NIO kernel has. git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8934 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../com/jme3/network/kernel/udp/UdpKernel.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/engine/src/networking/com/jme3/network/kernel/udp/UdpKernel.java b/engine/src/networking/com/jme3/network/kernel/udp/UdpKernel.java index 54ad4140d..53a29fa78 100644 --- a/engine/src/networking/com/jme3/network/kernel/udp/UdpKernel.java +++ b/engine/src/networking/com/jme3/network/kernel/udp/UdpKernel.java @@ -169,6 +169,16 @@ public class UdpKernel extends AbstractKernel socketEndpoints.remove( p.getRemoteAddress() ); addEvent( EndpointEvent.createRemove( this, p ) ); + + // If there are no pending messages then add one so that the + // kernel-user knows to wake up if it is only listening for + // envelopes. + if( !hasEnvelopes() ) { + // Note: this is not really a race condition. At worst, our + // event has already been handled by now and it does no harm + // to check again. + addEnvelope( EVENTS_PENDING ); + } } protected void newData( DatagramPacket packet )