AlexStocks commented on a change in pull request #82:
URL: https://github.com/apache/dubbo-getty/pull/82#discussion_r739674647



##########
File path: session.go
##########
@@ -418,10 +419,20 @@ func (s *session) WriteBytes(pkg []byte) (int, error) {
                return 0, ErrSessionClosed
        }
 
-       lg, err := s.Connection.send(pkg)
+       totalSize := len(pkg)
+       pkgs := make([][]byte, 0, totalSize/maxPacketLen+1)
+       writeSize := 0
+       for totalSize >= maxPacketLen {
+               pkgs = append(pkgs, pkg[writeSize:(writeSize+maxPacketLen)])
+               totalSize -= maxPacketLen
+               writeSize += maxPacketLen
+       }
+       pkgs = append(pkgs, pkg[writeSize:])
+       lg, err := s.Connection.send(pkgs)

Review comment:
       u need not to change the codes so quickly. pls test it firstly.




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to