Bugs item #822974, was opened at 2003-10-13 21:21
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=822974&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Mitchel Quinn (mnquinn)
Assigned to: Nobody/Anonymous (nobody)
Summary: Telnet.read_until() timeout parameter misleading 

Initial Comment:
Telnet.read_until(str,timeout) documentation reads as
follows:
Read until a given string, expected, is encountered or
until timeout seconds have passed.

When no match is found, return whatever is available
instead, possibly the empty string. Raise EOFError if
the connection is closed and no cooked data is available. 

However, the method does not behave in this manner. The
method will only return if the call to select() on the
socket is blocked for longer than the specified
timeout. If there is a steady stream of data available,
and it does not contain the specified string, this
method will _NEVER_ return.

A possible solution would be to subtract the elapsed
time from the given timeout each time through the while
loop.

Here's a snippet of the code from telnetlib.py
read_until():

        if timeout is not None:
            s_args = s_args + (timeout,)
        while not self.eof and apply(select.select,
s_args) == s_reply:
            i = max(0, len(self.cookedq)-n)
            self.fill_rawq()
            self.process_rawq()
            i = self.cookedq.find(match, i)
            if i >= 0:
                i = i+n
                buf = self.cookedq[:i]
                self.cookedq = self.cookedq[i:]
                return buf
        return self.read_very_lazy()






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

>Comment By: Martin v. Löwis (loewis)
Date: 2006-07-03 15:03

Message:
Logged In: YES 
user_id=21627

This is fixed with said patch.

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

Comment By: Johan M. Hahn (johahn)
Date: 2003-10-17 12:31

Message:
Logged In: YES 
user_id=887415

I confirm everything Mitchel wrote + I have submitted a patch 
for this:


http://sourceforge.net/tracker/index.php?
func=detail&aid=825417&group_id=5470&atid=305470




...johahn


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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=822974&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to