Resolve should track queries and handlers
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- cpp
- Ambito
- networking
Direzione di ricerca
Inizia esaminando il percorso di lookup DNS basato su Socket, inclusi l’handler onDNS, l’API resolve() e la classe Function descritta nell’issue. Confronta i tre helper di callback Function proposti e le opzioni dell’API DNS, quindi documenta il workaround per la race condition e definisci test o esempi che dimostrino lookup concorrenti senza sovrascrivere gli handler.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Currently, when a DNS lookup is initiated from a particular socket, an onDNS handler is installed in the socket. However, if a second query is initiated before the first finishes, that can overwrite the original onDNS handler. This creates a race condition on a per-socket basis.
There are three steps to a solution for this problem:
- Document the race condition and provide a workaround (create a socket for each DNS lookup)
- Provide a mechanism for escalating function pointer/
void*pairs to full C++11 functors (including lambdas, etc.) - Provide a DNS lookup API that does not require a socket.
C Function escalation mechanism
It is common practice to provide the DNS callback with a void* user-supplied callback.
This could be used to supply a object/function pair, though this does not account for virtual inheritance. The Function API could provide a convenient abstraction for this problem, allowing a C function pointer with a void * context object to escalate to a full C++11 call, including lambdas, etc.
Providing this abstraction requires a three class-static API functions provided by the Function class:
get_reference()obtains avoid *pointer to the target functor and increment a the reference countcall_from_void()Translates avoid *back to aFunctionInterface *and calls itcall_from_void_dec()Exactly the same ascall_from_void(), except that it also decrements the reference count.
DNS lookup API
The DNS lookup API currently uses the Socket instance as a proxy for discovering the stack in use. This is unnecessary and makes the API more cumbersome. In single-stack environments, resolve() can be a free function. In multi-stack environments, it can be:
- a free/static function that iterates through stacks until a match is found
- a free/static function that takes either a stack index or a stack ID
- a function bound to each network interface
- a function bound to the socket, that requires an open socket (the current status-quo)
Option 1) seems to be the least cumbersome option.
cc @bogdanm @adbridge @autopulated @0xc0170
- Lingua principale
- C++
- Stelle
- 6
- Fork
- 18
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ARMmbed/sockets
-
mirrored
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 30/100
-
mirrored
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
-
mirrored
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
UDPSocket issuesApertamirrored
Difficoltà 4/5 3-5 giorni Idoneità per principianti 42/100
Tutte le issue di ARMmbed/sockets
Issue simili
-
Linux npm packaging leaves workspace files that block subsequent CI checkoutForse già presa @Spockkk0225 l’ha presa oggi. Apertaci
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
alibaba/neug#1195 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 3 giorni
-
QA/No release-notes/exclude tests tests/missing-coverage tests/test-quality
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
brave/brave-browser#61019 ·
I maintainer di solito rispondono entro 1 giorno
-
? - Needs Triage bug CUTLASS C++
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 4 giorni