gnodet commented on a change in pull request #123:
URL: https://github.com/apache/mina-sshd/pull/123#discussion_r412193011



##########
File path: 
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
##########
@@ -954,7 +954,9 @@ protected IoWriteFuture doWritePacket(Buffer buffer) throws 
IOException {
         synchronized (encodeLock) {
             Buffer packet = resolveOutputPacket(buffer);
             IoSession networkSession = getIoSession();
-            return networkSession.writePacket(packet);
+            IoWriteFuture future = networkSession.writePacket(packet);
+            buffer.rpos(buffer.wpos());
+            return future;

Review comment:
       Not sure to understand.  The `buffer` and `packet` variable are not the 
same objects.  I think we could also write:
   ```
     synchronized (encodeLock) {
               Buffer packet = resolveOutputPacket(buffer);
               buffer.rpos(buffer.wpos());
               IoSession networkSession = getIoSession();
               IoWriteFuture future = networkSession.writePacket(packet);
               return future;
           }
   ```
   and it would also work.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org
For additional commands, e-mail: dev-h...@mina.apache.org

Reply via email to