cloudhopper-smpp icon indicating copy to clipboard operation
cloudhopper-smpp copied to clipboard

SmppSession#isBound returns true even when the channel closed

Open krasa opened this issue 9 years ago • 2 comments

easily reproducible on both master and netty4, connect and then shutdown the server

public static void main(String[] args) throws UnrecoverablePduException, SmppChannelException, InterruptedException, SmppTimeoutException {
        DefaultSmppClient clientBootstrap = new DefaultSmppClient(Executors.newCachedThreadPool());
        SmppSessionConfiguration config = new SmppSessionConfiguration();
        config.setWindowSize(1);
        config.setHost("127.0.0.1");
        config.setPort(5000);
        try {
            SmppSession session = clientBootstrap.bind(config,new DefaultSmppSessionHandler());
            while (session.isBound()) { //always true
                System.out.println("bound");
                Thread.sleep(1000);
            }
        } finally {
            System.out.println("destroying");
            clientBootstrap.destroy();
        }
    }

Seems to me that DefaultSmppSession#fireChannelClosed should update the state

krasa avatar Apr 18 '15 15:04 krasa

Looks like a good find. Do you think you could produce a unit test & fix in a PR?

jjlauer avatar Apr 18 '15 17:04 jjlauer

yeah, sure.

krasa avatar Apr 18 '15 18:04 krasa