Subject: [clisp-list] socket-stream-peer fails on buffered streams

From: Todd Sabin <[email-masked]>
Date: Wed Jan 2 19:50:01 2002

[1]> (setq *my-sock* (socket-connect 80 "jetcar.qnz.org" :buffered t))
#<IO BUFFERED SOCKET-STREAM CHARACTER jetcar.qnz.org:80>
[2]> (socket-stream-peer *my-sock*)

*** - UNIX error 9 (EBADF): Bad file number
1. Break [3]> 

Problem is the use of strm_ichannel instead of strm_buffered_channel
on a buffered stream.

Patch against current cvs:

--- stream.d~	Tue Jan  1 23:09:10 2002
+++ stream.d	Wed Jan  2 22:21:06 2002
@@ -14965,7 +14965,9 @@
   var bool resolve_p = (eq(NIL,STACK_0) || eq(unbound,STACK_0));
   skipSTACK(1);
   var object stream = test_socket_stream(popSTACK(),true);
-  var SOCKET sk = TheSocket(TheStream(stream)->strm_ichannel);
+  var SOCKET sk = ChannelStream_buffered (stream) 
+        ? TheSocket(TheStream(stream)->strm_buffered_channel)
+        : TheSocket(TheStream(stream)->strm_ichannel);
   var host_data hd;
 
     begin_system_call();

It looks like there are probably other places that may need something
similar.

Todd

---

From: Sam Steingold <[email-masked]>
Date: Sat Jan 5 12:31:03 2002

> * In message <[email-masked]>
> * On the subject of "[clisp-list] socket-stream-peer fails on buffered streams"
> * Sent on 02 Jan 2002 22:48:57 -0500
> * Honorable Todd Sabin <[email-masked]> writes:
>

thanks for the bug report - I fixed this bug in the CVS.

-- 
Sam Steingold (http://www.podval.org/~sds)
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Life is a sexually transmitted disease with 100% mortality.