Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Net-SSH2 CPAN distribution.

Report information
The Basics
Id:
106928
Status:
resolved
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
goldenspider [...] aliyun.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Net-SSH2-0.54_01 bug for net_ch_write
Date: Mon, 07 Sep 2015 20:07:52 +0800
To: "bug-Net-SSH2" <bug-Net-SSH2@rt.cpan.org>
From: "goldenspider" <goldenspider@aliyun.com>

net_ch_write:

1.

    while (offset < len_buffer) {
        int count = libssh2_channel_write_ex(ch->channel, XLATEXT,                //one
                                             pv_buffer + offset,
                                             len_buffer - offset);
        if (count >= 0)
            offset += count;
        else if (!((count == LIBSSH2_ERROR_EAGAIN) &&                                  //two
                   libssh2_session_get_blocking(ch->ss->session)))

            break;
    }

//outside count will always equ 0.

2.

else   if (LIBSSH2_ERROR_EAGAIN == count
                && libssh2_session_get_blocking(ch->ss->session) == 0)


is better?

Subject: Re: [rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write
Date: Mon, 7 Sep 2015 12:54:31 +0000 (UTC)
To: "bug-Net-SSH2@rt.cpan.org" <bug-Net-SSH2@rt.cpan.org>
From: Salvador Fandino <sfandino@yahoo.com>
Show quoted text
----- Original Message -----
> From: goldenspider via RT <bug-Net-SSH2@rt.cpan.org> > To: > Cc: > Sent: Monday, September 7, 2015 2:08 PM > Subject: [rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write > > Mon Sep 07 08:08:08 2015: Request 106928 was acted upon. > Transaction: Ticket created by goldenspider@aliyun.com > Queue: Net-SSH2 > Subject: Net-SSH2-0.54_01 bug for net_ch_write > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: goldenspider@aliyun.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106928 > > > > net_ch_write:1. while (offset < len_buffer) { > int count = libssh2_channel_write_ex(ch->channel, > XLATEXT, //one > pv_buffer + offset, > len_buffer - offset); > if (count >= 0) > offset += count; > else if (!((count == LIBSSH2_ERROR_EAGAIN) > && //two > libssh2_session_get_blocking(ch->ss->session))) > break; > }//outside count will always equ 0.2.else if (LIBSSH2_ERROR_EAGAIN == > count > && libssh2_session_get_blocking(ch->ss->session) > == 0)
> is better?
Sorry, I am not understanding what you say. The current version is not trivial because if has to handle all the following cases: 1. in blocking mode, write all the data 2. in non-blocking mode, write as much data as possible without blocking 3. if some error happens a. if some data was already written, discard the error and report the number of bytes written. b. if no data was written, report the error.
Subject: 答复:[rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write
Date: Mon, 07 Sep 2015 21:58:11 +0800
To: "bug-Net-SSH2" <bug-Net-SSH2@rt.cpan.org>
From: "goldenspider" <goldenspider@aliyun.com>

I mean, there's a problem with the count variable.   It should not redefine => int count.    

Outside of while, it will always be 0. 




 
Show quoted text

------------------------------------------------------------------

发件人:Salvador \"Fandiño\" via RT <bug-Net-SSH2@rt.cpan.org>

发送时间:2015年9月7日(星期一) 20:55

收件人:goldenspider <goldenspider@aliyun.com>

主 题:Re: [rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write

 

<URL: https://rt.cpan.org/Ticket/Display.html?id=106928 >





----- Original Message -----
> From: goldenspider via RT <bug-Net-SSH2@rt.cpan.org>
> To: 
> Cc: 
> Sent: Monday, September 7, 2015 2:08 PM
> Subject: [rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write

> Mon Sep 07 08:08:08 2015: Request 106928 was acted upon.
> Transaction: Ticket created by goldenspider@aliyun.com
>        Queue: Net-SSH2
>      Subject: Net-SSH2-0.54_01 bug for net_ch_write
>    Broken in: (no value)
>     Severity: (no value)
>        Owner: Nobody
>   Requestors: goldenspider@aliyun.com
>       Status: new
> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106928 >


> net_ch_write:1.    while (offset < len_buffer) {
>         int count = libssh2_channel_write_ex(ch->channel, 
> XLATEXT,                //one
>                                              pv_buffer + offset,
>                                              len_buffer - offset);
>         if (count >= 0)
>             offset += count;
>         else if (!((count == LIBSSH2_ERROR_EAGAIN) 
> &&                                  //two
>                    libssh2_session_get_blocking(ch->ss->session)))
>             break;
>     }//outside count will always equ 0.2.else   if (LIBSSH2_ERROR_EAGAIN == 
> count
>                 && libssh2_session_get_blocking(ch->ss->session) 
> == 0)

> is better?

Sorry, I am not understanding what you say.

The current version is not trivial because if has to handle all the following cases:

1. in blocking mode, write all the data
2. in non-blocking mode, write as much data as possible without blocking
3. if some error happens
  a. if some data was already written, discard the error and report the number of bytes written.
  b. if no data was written, report the error.
Subject: Re: 答复:[rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write
Date: Mon, 7 Sep 2015 14:27:54 +0000 (UTC)
To: "bug-Net-SSH2@rt.cpan.org" <bug-Net-SSH2@rt.cpan.org>
From: Salvador Fandino <sfandino@yahoo.com>
Show quoted text
----- Original Message -----
> From: goldenspider via RT <bug-Net-SSH2@rt.cpan.org> > To: > Cc: > Sent: Monday, September 7, 2015 3:58 PM > Subject: 答复:[rt.cpan.org #106928] Net-SSH2-0.54_01 bug for net_ch_write > > Queue: Net-SSH2 > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106928 > >
> I mean, there's a problem with the count variable. It should not redefine > => int count. Outside of while, it will always be 0.
Oh, you are completely right, good catch!
fixed!


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.