Git Product home page Git Product logo

Comments (9)

aaugustin avatar aaugustin commented on June 2, 2024 1

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.

aaugustin avatar aaugustin commented on June 2, 2024 1

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.

aaugustin avatar aaugustin commented on June 2, 2024 1

Perhaps I should rewrite that test to use a real IP socket.

from websockets.

aaugustin avatar aaugustin commented on June 2, 2024 1

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.

aaugustin avatar aaugustin commented on June 2, 2024 1

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.

aaugustin avatar aaugustin commented on June 2, 2024

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.

mtelka avatar mtelka commented on June 2, 2024

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.

mtelka avatar mtelka commented on June 2, 2024

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.

mtelka avatar mtelka commented on June 2, 2024

I just tested websockets 12.0 + b3c5195 and I can confirm that the issue is gone.

Thank you!

from websockets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.