Comments (9)
This is likely related to the implementation of socket.socketpair and/or socket.socket.getpeername on OpenIndiana.
That's what I'm using for testing and how remote_connection
is implemented respectively.
The documentation of getpeername
acknowledges that it isn't supported on some systems. OpenIndiana may be one of those systems.
Do you a concrete proposal that doesn't make the code or the tests more complex?
from websockets.
Try this:
>>> local, remote = socket.socketpair()
>>> local.getpeername()
''
>>>
I expect that you'll get None
instead of the empty string.
This shows that the test isn't very good... I will think about it.
from websockets.
Perhaps I should rewrite that test to use a real IP socket.
from websockets.
Thank you for confirming.
Honestly this test doesn't test anything beyond the existence of a remote_address
method that doesn't crash. I could remove the assertion that it doesn't return None
. Anyway the return value is "whatever getpeername
returns"; that's platform specific.
from websockets.
I mocked socket methods with platform-specific behavior to make the tests more robust. Hopefully that'll do the job on OpenIndiana. Please let me know if it doesn't.
from websockets.
For clarity: to me this is an OpenIndiana and/or Python issue; websockets isn't the right level to fix this.
If there's an easy solution that adds no maintenance cost and helps you, of course I'll consider it.
The onus of proposing it is on you, though, because you're the one who wants to run the tests on OpenIndiana (and I wish you didn't, as explained in #1426).
from websockets.
This is likely related to the implementation of socket.socketpair and/or socket.socket.getpeername on OpenIndiana.
Could you please suggest some simple test that would prove the problem is either in socket.socketpair and/or socket.socket.getpeername on OpenIndiana?
I tried this:
$ python
Python 3.9.16 (main, Feb 19 2023, 15:42:40)
[GCC 10.4.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.socketpair()
(<socket.socket fd=5, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>, <socket.socket fd=4, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>)
But that's apparently not enough.
Thank you.
from websockets.
Yes, exactly, None
:
$ python
Python 3.9.16 (main, Feb 19 2023, 15:42:40)
[GCC 10.4.0] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> local, remote = socket.socketpair()
>>> local.getpeername()
>>> print(local.getpeername())
None
>>>
from websockets.
I just tested websockets 12.0 + b3c5195 and I can confirm that the issue is gone.
Thank you!
from websockets.
Related Issues (20)
- 0 bytes read on a total of 2 expected bytes HOT 2
- Secure websocket using example code unable to handle unsecured requests HOT 4
- No route to host----when access IPv6 address failed,no attempt was made to access an IPv4 address HOT 1
- How to close a client connection using the threading interface while stuck in ClientConnection.recv
- Can we get more attention in the threaded client interface? HOT 1
- Human-readable representation of a frame is too short HOT 2
- No module websockets.imports HOT 2
- Sync client stops process exit when running in a Thread if not explicitly closed HOT 5
- Python 3.11 incompatible with websockets\legacy\protocol.py Error "got an unexpected keyword argument 'loop'" HOT 1
- Strange problem, client cannot receive messages from the server, after sending a certain amount of messages. HOT 2
- Cannot Send message to a single client.
- handling multiple websocket client connections HOT 4
- Enable to connect ! invalid handshake HOT 7
- recv() is slow HOT 5
- Client state is incorrect HOT 1
- Feature batch receive HOT 2
- [QUESTION] Switching from websocket-client to websockets HOT 1
- Sync version of broadcast HOT 2
- Running Scheduled Task in Websokcets Or Scaling with multiple workers HOT 1
- await websocket.recv() block the coroutine loop. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from websockets.