aresch / pyenet

A python wrapper for the ENet library
BSD 3-Clause "New" or "Revised" License
53 stars 30 forks source link

Compile time options for HIDE_SOCKET_FILENO and FAST_CONNECT_DROP #7

Closed noway closed 7 years ago

noway commented 7 years ago

Enables to hide Socket.fileno function (from external SDK for example, so it wouldn't be possible to abuse the underlying Socket connection instead of using intercept callback properly)

As well as fast Connect Drop where it can return None instead of the event on disconnect of the peer.

Enabled through compile time options in setup.py.

Tested it with py2k and py3k, works fine.

Voice the concern if you have any :-)

NotAFile commented 7 years ago

@aresch could you have a look at this?

aresch commented 7 years ago

I'm a little confused on the point of hiding the fileno() method, but I'd be more inclined to just remove it then trying to add a compile option to hide it since I'm not convinced its particularly useful. Also, I'm not sure why the FAST_CONNECT_DROP needs to be a compile-time option. It could probably just be added as an kwarg to Host.init or even just to the service() method. I think that doing this would reduce the complexity of this change.

noway commented 7 years ago

HIDE_SOCKET_FILENO is indeed pretty redundant and I would go without it. I'd simply forego this option as because it is pretty useless.

Re: kwargs to Host.__init__: sounds like a great idea, definitely something I'd go with.

noway commented 7 years ago

Superseded by #9