package org.framework.lazy.cloud.network.heartbeat.server.netty.advanced;

import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.framework.lazy.cloud.network.heartbeat.common.NettyCommunicationIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.NettyProxyMsg;
import org.framework.lazy.cloud.network.heartbeat.common.NettyRealIdContext;
import org.framework.lazy.cloud.network.heartbeat.common.advanced.server.AbstractHandleReportServicePermeateClientCloseVisitorTypeAdvanced;

/**
 * 服务端处理客户端 关闭一个访客
 */
@Slf4j
@Component
public class ServerHandleReportServicePermeateClientCloseVisitorTypeAdvanced extends AbstractHandleReportServicePermeateClientCloseVisitorTypeAdvanced<NettyProxyMsg> {


    /**
     * 处理当前数据
     *
     * @param channel       当前通道
     * @param nettyProxyMsg 通道数据
     */
    @Override
    protected void doHandler(Channel channel, NettyProxyMsg nettyProxyMsg) {
        // 关闭访客通道
        byte[] visitorId = nettyProxyMsg.getVisitorId();
        NettyCommunicationIdContext.clear(visitorId);
        NettyRealIdContext.clear(visitorId);
    }
}
