def readline(self):
         """Reads just one line, new line character included
         """
-        buf = []
-        pos = 0
+        # if \n in dbuf, no read neads to be done
+        if '\n' in self.dbuf:
+            pos = self.dbuf.index('\n') + 1
+            ret = self.dbuf[:pos]
+            self.dbuf = self.dbuf[pos:]
+            return ret
+
+        buf = [self.dbuf]
+        self.dbuf = ""
         while True:
             chunk = self._read(self.bufsize)
 
+            # nothing more to read, so return the buffer
             if not chunk:
                 return ''.join(buf)
 
             buf.append(chunk)
+
+            # if \n found, return the new line
             if '\n' in chunk:
                 dbuf = ''.join(buf)
                 pos = dbuf.index('\n') + 1