[prev in list] [next in list] [prev in thread] [next in thread]
List: libssh2-devel
Subject: Re: [libssh2] recent change in channel_read_ex
From: "Paul Thomas" <thomaspu () gmail ! com>
Date: 2008-11-01 17:30:32
Message-ID: c52222ba0811011030y34c79fc2oe87c1d9c05591860 () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
E L,
I just checked in a change that should fix this issue in the latest CVS
version. Please update your code to the latest CVS and let me know if you
still encounter this issue. I would have messed with it sooner, but I had
two different family members get married this month!
Paul
On Mon, Oct 20, 2008 at 1:22 PM, Paul Thomas <thomaspu@gmail.com> wrote:
> That patch that I added that changed the line you are referring to was done
> to fix an issue where small amounts of data weren't getting picked up on the
> channel_read when it only recieved 1~8 chars of data. Looks like I forgot a
> case dealing with the while loop on line 1533.
>
> I took a quick look....That if statement needs to take into account when
> the condition
> channel->read_bytes_read == (int) buflen
> is true and if so, also enter the error state. That's why you're seeing the
> code get stuck in the loop.
>
> Paul
>
>
>
> On Mon, Oct 20, 2008 at 12:47 PM, E L <crc1021@gmail.com> wrote:
>
>> There was change in libssh2_channel_read_ex, in the check of rc < 0
>> if (channel->read_block) {
>> /* in the second lap and onwards, do this */
>> rc = libssh2_packet_read(session);
>> channel->read_packet = session->packets.head;
>> }
>>
>> /* We didn't read any data from the socket and
>> * no packets are waiting to be read */
>> if ((rc < 0) && (! channel->read_packet)) {
>> if (rc != PACKET_EAGAIN) {
>> channel->read_state = libssh2_NB_state_idle;
>> }
>> /* no packets available */
>> return rc;
>> }
>>
>> This is causing problems for me, the code appears to spin in some busy
>> wait loop.
>>
>> This issue is that rc == LIBSSH2_ERROR_EAGAIN and
>> session->packets.head is not NULL, so the error checking code is not
>> entered. Reverting that line by removing the "&& (!
>> channel->read_packet)", make the code work again.
>>
>> Code is from libssh2-0.19.0-20081020, compiled with mingw on win XP,
>> and used in libcurl.
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> libssh2-devel mailing list
>> libssh2-devel@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/libssh2-devel
>>
>
>
[Attachment #5 (text/html)]
E L,<br><br>I just checked in a change that should fix this issue in the latest CVS \
version. Please update your code to the latest CVS and let me know if you still \
encounter this issue. I would have messed with it sooner, but I had two different \
family members get married this month!<br> <br>Paul<br><br><div \
class="gmail_quote">On Mon, Oct 20, 2008 at 1:22 PM, Paul Thomas <span \
dir="ltr"><<a href="mailto:thomaspu@gmail.com">thomaspu@gmail.com</a>></span> \
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, \
204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div dir="ltr">That patch that \
I added that changed the line you are referring to was done to fix an issue where \
small amounts of data weren't getting picked up on the channel_read when it only \
recieved 1~8 chars of data. Looks like I forgot a case dealing with the while loop on \
line 1533.<br>
<br>I took a quick look....That if statement needs to take into account when the \
condition<br> channel->read_bytes_read == (int) buflen<br>is true and \
if so, also enter the error state. That's why you're seeing the code get \
stuck in the loop. <br> <font color="#888888">
<br>Paul</font><div><div></div><div class="Wj3C7c"><br><br><br><div \
class="gmail_quote">On Mon, Oct 20, 2008 at 12:47 PM, E L <span dir="ltr"><<a \
href="mailto:crc1021@gmail.com" target="_blank">crc1021@gmail.com</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> There was change in \
libssh2_channel_read_ex, in the check of rc < 0<br> if \
(channel->read_block) {<br> /* in the \
second lap and onwards, do this */<br> rc = \
libssh2_packet_read(session);<br> \
channel->read_packet = session->packets.head;<br> \
}<br> <br>
/* We didn't read any data from the socket and<br>
* no packets are waiting to be read */<br>
if ((rc < 0) && (! channel->read_packet)) \
{<br> if (rc != \
PACKET_EAGAIN) {<br> \
channel->read_state = libssh2_NB_state_idle;<br> \
}<br> /* no packets \
available */<br> return rc;<br>
}<br>
<br>
This is causing problems for me, the code appears to spin in some busy<br>
wait loop.<br>
<br>
This issue is that rc == LIBSSH2_ERROR_EAGAIN and<br>
session->packets.head is not NULL, so the error checking code is not<br>
entered. Reverting that line by removing the "&& (!<br>
channel->read_packet)", make the code work again.<br>
<br>
Code is from libssh2-0.19.0-20081020, compiled with mingw on win XP,<br>
and used in libcurl.<br>
<br>
-------------------------------------------------------------------------<br>
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge<br>
Build the coolest Linux based applications with Moblin SDK & win great prizes<br>
Grand prize is a trip for two to an Open Source event anywhere in the world<br>
<a href="http://moblin-contest.org/redirect.php?banner_id=100&url=/" \
target="_blank">http://moblin-contest.org/redirect.php?banner_id=100&url=/</a><br>
_______________________________________________<br>
libssh2-devel mailing list<br>
<a href="mailto:libssh2-devel@lists.sourceforge.net" \
target="_blank">libssh2-devel@lists.sourceforge.net</a><br> <a \
href="https://lists.sourceforge.net/lists/listinfo/libssh2-devel" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/libssh2-devel</a><br> \
</blockquote></div><br></div></div></div> </blockquote></div><br>
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic