Skip to content

Commit

Permalink
body encode empty byte bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
闫逍旭 committed Jan 8, 2016
1 parent 3db4c70 commit a31f20f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Expand Up @@ -6,14 +6,14 @@
public class KickRemoteMsg { public class KickRemoteMsg {
public String userId; public String userId;
public String deviceId; public String deviceId;
public String srcServer; public String targetServer;


@Override @Override
public String toString() { public String toString() {
return "KickRemoteMsg{" + return "KickRemoteMsg{" +
"userId='" + userId + '\'' + "userId='" + userId + '\'' +
", deviceId='" + deviceId + '\'' + ", deviceId='" + deviceId + '\'' +
", srcServer='" + srcServer + '\'' + ", targetServer='" + targetServer + '\'' +
'}'; '}';
} }
} }
Expand Up @@ -13,7 +13,6 @@
import com.shinemo.mpush.tools.MPushUtil; import com.shinemo.mpush.tools.MPushUtil;
import com.shinemo.mpush.tools.redis.listener.MessageListener; import com.shinemo.mpush.tools.redis.listener.MessageListener;
import com.shinemo.mpush.tools.redis.manage.RedisManage; import com.shinemo.mpush.tools.redis.manage.RedisManage;
import com.shinemo.mpush.tools.redis.pubsub.Subscriber;
import io.netty.channel.ChannelFuture; import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelFutureListener;
import org.slf4j.Logger; import org.slf4j.Logger;
Expand Down Expand Up @@ -62,18 +61,24 @@ public void operationComplete(ChannelFuture future) throws Exception {


public void kickRemote(String userId, RemoteRouter router) { public void kickRemote(String userId, RemoteRouter router) {
ClientLocation location = router.getRouteValue(); ClientLocation location = router.getRouteValue();
//如果是本机直接忽略
if (location.getHost().equals(MPushUtil.getLocalIp())) { if (location.getHost().equals(MPushUtil.getLocalIp())) {
LOGGER.error("kick remote user but router in local, userId={}", userId); LOGGER.error("kick remote user but router in local, userId={}", userId);
return; return;
} }
KickRemoteMsg msg = new KickRemoteMsg(); KickRemoteMsg msg = new KickRemoteMsg();
msg.deviceId = location.getDeviceId(); msg.deviceId = location.getDeviceId();
msg.srcServer = location.getHost(); msg.targetServer = location.getHost();
msg.userId = userId; msg.userId = userId;
RedisManage.publish(KICK_CHANNEL, msg); RedisManage.publish(KICK_CHANNEL, msg);
} }


public void onReceiveKickRemoteMsg(KickRemoteMsg msg) { public void onReceiveKickRemoteMsg(KickRemoteMsg msg) {
//如果目标不是本机,直接忽略
if (!msg.targetServer.equals(MPushUtil.getLocalIp())) {
LOGGER.error("receive kick remote msg, target server error, localIp={}, msg={}", MPushUtil.getLocalIp(), msg);
return;
}
String userId = msg.userId; String userId = msg.userId;
LocalRouterManager routerManager = RouterCenter.INSTANCE.getLocalRouterManager(); LocalRouterManager routerManager = RouterCenter.INSTANCE.getLocalRouterManager();
LocalRouter router = routerManager.lookup(userId); LocalRouter router = routerManager.lookup(userId);
Expand Down

0 comments on commit a31f20f

Please sign in to comment.