8000 socket/socket-stream confusion in tests · Issue #133 · usocket/usocket · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

socket/socket-stream confusion in tests #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pvaneynd opened this issue Jan 5, 2025 · 1 comment
Open

socket/socket-stream confusion in tests #133

pvaneynd opened this issue Jan 5, 2025 · 1 comment

Comments

@pvaneynd
Copy link
pvaneynd commented Jan 5, 2025

Hi,

The tests USOCKET-TEST::SOCKET-LISTEN.1 and USOCKET-TEST::SOCKET-LISTEN.2 fail on sbcl 2.5.0 with errors like:

#<TYPE-ERROR expected-type: STREAM..
  [condition]

Slots with :INSTANCE allocation:
  DATUM                          = #<SB-BSD-SOCKETS:INET-SOCKET fd: 7 {10014C5923}>
  EXPECTED-TYPE                  = STREAM
  CONTEXT                        = NIL
Test USOCKET-TEST::SOCKET-LISTEN.2 failed

This code has (read-byte (usocket:socket server)) while I expected (read-byte (usocket:socket-stream server)). In fact with this the tests works.

Is this a fault in the test or in the usocket:socket function? From the documentation it is not clear to me.

@binghe
Copy link
Member
binghe commented Jan 7, 2025

Hello,

I think (read-byte (usocket:socket-stream server)) is the correct way, while (read-byte (usocket:socket server)) may also work for those backends in which the underlying "socket" (TCP) is also a valid Common Lisp stream (which supports functions like read-byte. This is still the case for LispWorks). I guess SBCL's behavior has changed in recent version, and this issue has been now exposed.

I will fix the test code (and review other testing failures).

Thanks,

Chun Tian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0