Added better close listener for UDP

This commit is contained in:
nathan 2018-04-04 15:02:17 +02:00
parent fdf4ecf39b
commit 6582caa521

View File

@ -13,10 +13,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package io.netty.bootstrap; package dorkbox.network.connection;
import dorkbox.network.connection.Connection; import io.netty.bootstrap.DatagramCloseMessage;
import dorkbox.network.connection.Listener;
/** /**
* Uses a hint to close remote UDP connections * Uses a hint to close remote UDP connections
@ -26,6 +25,8 @@ class DatagramCloseListener implements Listener.OnMessageReceived<Connection, Da
@Override @Override
public public
void received(final Connection connection, final DatagramCloseMessage message) { void received(final Connection connection, final DatagramCloseMessage message) {
connection.close(); if (connection instanceof ConnectionImpl) {
((ConnectionImpl) connection).forceClose();
}
} }
} }