summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
7049800)
Fixed racecondition between releasing of netty ByteBuff and removing the msg from pendingWrites.
Change-Id: I40eff55d9c7858534d105a242d3ec6feb9d950d0
Signed-off-by: Tomas Cere <tcere@cisco.com>
//sending message with pending
//if resending message not succesfull, then attribute wasPending is true
//sending message with pending
//if resending message not succesfull, then attribute wasPending is true
- private void writeWithPendingDetection(final ChannelHandlerContext ctx, final ChannelPromise promise, final ByteBuf byteBufMsg, boolean wasPending) {
+ private void writeWithPendingDetection(final ChannelHandlerContext ctx, final ChannelPromise promise, final ByteBuf byteBufMsg, final boolean wasPending) {
try {
if (LOG.isTraceEnabled()) {
try {
if (LOG.isTraceEnabled()) {
public void operationComplete(final IoWriteFuture future) {
if (LOG.isTraceEnabled()) {
LOG.trace("Ssh write request finished on channel: {} with result: {}: and ex:{}, message: {}",
public void operationComplete(final IoWriteFuture future) {
if (LOG.isTraceEnabled()) {
LOG.trace("Ssh write request finished on channel: {} with result: {}: and ex:{}, message: {}",
- ctx.channel(), future.isWritten(), future.getException(), byteBufToString(byteBufMsg));
+ ctx.channel(), future.isWritten(), future.getException(), byteBufToString(byteBufMsg));
}
// Notify success or failure
}
// Notify success or failure
// Not needed anymore, release
byteBufMsg.release();
// Not needed anymore, release
byteBufMsg.release();
+ synchronized (AsyncSshHandlerWriter.this) {
+ //rescheduling message from queue after successfully sent
+ if (wasPending) {
+ byteBufMsg.resetReaderIndex();
+ pending.remove();
+ }
+ }
+
// Check pending queue and schedule next
// At this time we are guaranteed that we are not in pending state anymore so the next request should succeed
writePendingIfAny();
// Check pending queue and schedule next
// At this time we are guaranteed that we are not in pending state anymore so the next request should succeed
writePendingIfAny();
- //rescheduling message from queue after successfully sent
- if(wasPending){
- byteBufMsg.resetReaderIndex();
- pending.remove();
- }
-
} catch (final WritePendingException e) {
if(wasPending == false){
} catch (final WritePendingException e) {
if(wasPending == false){