Fixed.
authorDaiki Ueno <ueno@unixuser.org>
Sun, 14 Dec 2003 04:12:37 +0000 (04:12 +0000)
committerDaiki Ueno <ueno@unixuser.org>
Sun, 14 Dec 2003 04:12:37 +0000 (04:12 +0000)
lisp/riece-async.el

index 30eb658..4edf500 100644 (file)
@@ -62,6 +62,11 @@ loop do
   rfds, wfds, = select([socket, $stdin], wfds_in)
   unless wfds.empty?
     begin
   rfds, wfds, = select([socket, $stdin], wfds_in)
   unless wfds.empty?
     begin
+      until buf.length <= " max-buffer-size "
+        i = buf.index(\"\r\n\")
+        break unless i
+        buf.slice!(0 .. i + 1)
+      end
       until buf.empty?
         len = $stdout.syswrite(buf)
         buf.slice!(0 .. len)
       until buf.empty?
         len = $stdout.syswrite(buf)
         buf.slice!(0 .. len)
@@ -79,9 +84,6 @@ loop do
     else
       wfds_in = [$stdout]
       buf << line
     else
       wfds_in = [$stdout]
       buf << line
-      until buf.length <= " max-buffer-size "
-        buf.slice!(0 .. buf.index(\"\r\n\"))
-      end
     end
   end
   if rfds.include?($stdin)
     end
   end
   if rfds.include?($stdin)