Comments (7)
Fixed in b383275.
from anyio.
Are you intent on disabling TCP_NODELAY
for your sockets?
from anyio.
I want to be able to execute code similar to the following:
socket.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
if hasattr(socket, "TCP_KEEPIDLE"):
socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPIDLE, 300)
elif is_darwin():
# Darwin specific option
# Value extracted from XNU source code
# https://github.com/apple/darwin-xnu/blob/a449c6a3b8014d9406c2ddbdc81795da24aa7443/bsd/netinet/tcp.h#L207
TCP_KEEPALIVE = 16
socket.setsockopt(socket.IPPROTO_TCP, TCP_KEEPALIVE, 300)
socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPINTVL, 30)
socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_KEEPCNT, 5)
socket.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
from anyio.
Yes, I get the use case for setsockopt()
. I was merely wondering whether or not you knew that TCP_NODELAY
is set for socket streams by default on anyio.
from anyio.
I implemented getsockopt()
and setsockopt()
in SocketStream
but now I keep wondering if I should expose the raw socket instead. After all, the socket object has a huge amount of low level functionality but I'm uncertain whether it should be exposed or not.
from anyio.
Did you test it?
I'm getting TypeError: setsockopt() takes exactly 3 arguments (4 given)
when calling socket_stream.setsockopt(socket.SOL_SOCKET, socket.SO_KEEPALIVE, 1)
socket.SocketType.setsockopt
is a weird built-in method, it does not seem to work when you manually pass optlen=None
from anyio.
It seems that I only tested getsockopt()
but forgot about setsockopt()
. I will fix this tomorrow.
from anyio.
Related Issues (20)
- `ClosedResourceError` vs. `BrokenResourceError` is sometimes backend-dependent, and is sometimes not raised at all (in favor of a non-AnyIO exception type)
- Add `deliver_cancel` parameter and `start` support to `run_process`
- Suspicion of flaky test: test_cancelscope_propagation_when_abandoned HOT 1
- Stricter typing for `TaskGroup.start()` HOT 1
- Cancelling a TaskGroup in which a task is starting all also cancel the TaskGroup in which it is due to run HOT 4
- [pytest] support keeping event loop for higher scope HOT 10
- Restore signal handlers at the end of `open_signal_receiver`. HOT 3
- service name not available for the specified socket type HOT 19
- RuntimeError when using Ctrl+C while awaiting a task using `await TaskGrup.start()` HOT 4
- 100% CPU load after cancel HOT 11
- run_process fails when running from .exe console_script entrypoint on windows HOT 2
- Different cancel scope behaviour on asyncio vs Trio HOT 2
- Hypothesis tests that are class members are passed self twice HOT 1
- TCP listener handler does not disconnect on EOF (netcat -N) HOT 7
- Using `request.getfixturevalue` triggers errors "This event loop is already running" HOT 1
- Raising an error inside a task of a task group can produce: `RuntimeError: called 'started' twice on the same task status` HOT 7
- Cancelling `TaskGroup.start()` cancels `TaskGroup` itself (only for `asyncio` backend) HOT 4
- anyio is unexpectedly cancelling tasks HOT 6
- Provide async `getfixturevalue()` method on anyio
- run_sync_in_worker_thread hangs when 2 calls made in quick succession HOT 2
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 anyio.