From 2cf78169031c35ce3589ce879ee87368e7b32a1e Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Sat, 18 Jul 2009 07:46:49 +0000 Subject: [PATCH] Reverted back to the previous MessageEvent implementation that should perform better in most cases --- .../jboss/netty/channel/DownstreamMessageEvent.java | 12 ++++++------ .../jboss/netty/channel/UpstreamMessageEvent.java | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java b/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java index 77ae6774b3..8b9464db45 100644 --- a/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java +++ b/src/main/java/org/jboss/netty/channel/DownstreamMessageEvent.java @@ -61,7 +61,11 @@ public class DownstreamMessageEvent implements MessageEvent { this.channel = channel; this.future = future; this.message = message; - this.remoteAddress = remoteAddress; + if (remoteAddress != null) { + this.remoteAddress = remoteAddress; + } else { + this.remoteAddress = channel.getRemoteAddress(); + } } public Channel getChannel() { @@ -77,11 +81,7 @@ public class DownstreamMessageEvent implements MessageEvent { } public SocketAddress getRemoteAddress() { - if (remoteAddress != null) { - return remoteAddress; - } else { - return getChannel().getRemoteAddress(); - } + return remoteAddress; } @Override diff --git a/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java b/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java index d0b6b4cb7c..5e64b1ccc7 100644 --- a/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java +++ b/src/main/java/org/jboss/netty/channel/UpstreamMessageEvent.java @@ -57,7 +57,11 @@ public class UpstreamMessageEvent implements MessageEvent { } this.channel = channel; this.message = message; - this.remoteAddress = remoteAddress; + if (remoteAddress != null) { + this.remoteAddress = remoteAddress; + } else { + this.remoteAddress = channel.getRemoteAddress(); + } } public Channel getChannel() { @@ -73,11 +77,7 @@ public class UpstreamMessageEvent implements MessageEvent { } public SocketAddress getRemoteAddress() { - if (remoteAddress != null) { - return remoteAddress; - } else { - return getChannel().getRemoteAddress(); - } + return remoteAddress; } @Override