Skip to content
This repository was archived by the owner on Nov 28, 2024. It is now read-only.
This repository was archived by the owner on Nov 28, 2024. It is now read-only.

Issue while sending very big command  #94

Description

@Jean-PhilippeD

Hi,

Referencing this issue I opened : paramiko/paramiko#2324

I tried a quick fix ofsend()command :

DEFAULT_MAX_PACKET_SIZE = 2**15

    def send(self, send_string, newline=None):
        """Saves and sends the send string provided."""
        self.current_send_string = send_string
        # send_string, _ = codecs.getdecoder(self.encoding)(send_string)
        newline = newline if newline is not None else self.newline
        # don't send till send_ready
        while not self.channel.send_ready():
            time.sleep(.009)
        if len(send_string) > DEFAULT_MAX_PACKET_SIZE:
            while len(send_string) > DEFAULT_MAX_PACKET_SIZE:
                chunck_string = send_string[:DEFAULT_MAX_PACKET_SIZE]
                self.channel.send(chunck_string)
                send_string = send_string[DEFAULT_MAX_PACKET_SIZE:]
        self.channel.send(send_string)
        self.channel.send(newline)

Here I loop over send_string until all payload is sent.

What do you think ?
It seems to work in my case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions