squaremiledev / asynctransport

Apache License 2.0
3 stars 2 forks source link

Close connection before all data sent - what to do in that case #13

Open michaelszymczak opened 4 years ago

michaelszymczak commented 4 years ago

work method hasn't been called:

                    for (int i = 0; i < 1000; i++)
                    {
                        if (numberCount >= messagesCap)
                        {
                            transport.handle(transport.command(connectionId, CloseConnection.class));
                            return;
                        }
                        SendMessage sendMessage = transport.command(connectionId, SendMessage.class);
                        sendMessage.prepare().putLong(sendMessage.offset(), numberCount);
                        sendMessage.commit(8);
                        transport.handle(sendMessage);
//                        transport.work();
                        numberCount++;
                    }
squaremiledev commented 3 years ago

Write a test to show what happens in this case.