New onData, onWritable overloads that mostly replace onAborted [draft]
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- cpp
- Área
- backend-api-design
Línea de trabajo
Start by reading the existing onData, onWritable, and onAborted callback implementations and their tests; the issue does not name specific files or test paths. Check how the proposed overloads interact with existing callbacks and language bindings, then define completion by adding the overload behavior and coverage for aborts, empty request bodies, and backward compatibility.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
onData(chunk, isFin)simplified as onData(2) becomesonData(std::optional<HttpSocket *> res, chunk, maxRemainingBodyLength)simplified as onData(3)- onData(chunk, isFin) and onDataV2 are implemented as wrappers for the "base" onData(3).
When onAborted would normally be called, onData(nullopt is called as well. The wrapped old onData(2) implementation filters out those calls to remain backwards compatible.
If onData(3) is called and there is no onAborted callback, a noop callback is set, so that the "you must attach onAborted handler bla bla bla" error is silenced. If onAborted is called after, it just overwrites that either way.
This means you can use (only) onData(3) instead of onData(2) + onAborted when you receive data. And you can also use onData(3) instead of onAborted, but there is a small overhead to this: namely that onData(3) is always emitted with a ("", 0) chunk even if there is no data (for instance a GET request). So for GET requests that need to wait for DB or timers, you would still want to use onAborted (only). At least if 1 extra call is too heavy (such as for JavaScript where a call is heavy weight).
In C++, you should be able to entirely replace onAborted with only onData(3) in all cases, since a function call is negligible, esp. if you the compiler inlined everything.
onWritable(1) which is the old onWritable(offset), gets a new overload: onWritable(std::optional<HttpSocket *> res, offset) which is onWritable(2), and behaves the same as onData(3), which means for streaming out, you only need to attach to onWritable(2). Just like onData(3), the onWritable(2) gets called with nullopt when onAborted would be called.
This also means that if you attach to all 3 callbacks, and abortion triggers, you get 3 events. But any sane set-up should use either only onData(3), only onWritable(2) or only onAborted.
- Lenguaje dominante
- C++
- Estrellas
- 19k
- Forks
- 1.9k
- Merge medio
- 3 h 59 min
- PR fusionados (30 d)
- 1
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de uNetworking/uWebSockets
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
uNetworking/uWebSockets#1964 ·
-
PROXY v2 parser rejects headers carrying TLVs, so IPv6 clients behind HAProxy hangPosiblemente ocupada @HawkForge la tomó hace 10 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 62/100
uNetworking/uWebSockets#1957 ·
-
Add collectBody from uWS.jsAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
uNetworking/uWebSockets#1953 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
uNetworking/uWebSockets#1948 ·
-
Some caching featuresAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
uNetworking/uWebSockets#1945 · 3 comentarios ·
Todos los issues de uNetworking/uWebSockets
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
cloudflare/workerd#8290 ·
Los mantenedores suelen responder en 1 día
-
scripts/moe-cache-tune.py: device_room() under-reports free VRAM when a draft model is loadedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 84/100
Vector35/binaryninja-api#8715 ·
Los mantenedores suelen responder en 2 días
-
ai_p3 comp-database-engines
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ClickHouse/ClickHouse#130186 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100