grpc / grpc/grpc-java

BinderTransport's TRANSPORT_ATTR_LOCAL_ADDR is different than its peer's TRANSPORT_ATTR_REMOTE_ADDR

Aperta
#12,347 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
binder
Lingua principale
Java
Stelle
12.1k
Fork
4k
Merge medio
2g 17h
PR unite (30g)
37

Descrizione

Today:
- BinderClientTransport's remote is the AndroidComponentAddress passed to bindService(), which makes sense.
- BinderServerTransport's local is its server's "listening" address, a meaningless concept constructed by calling `AndroidComponentAddress.forContext()` on the Service. This is basically an Intent with a ComponentName but no other fields set. Meaningless, because without considering the onBind() implementation and the setup there's no reason to believe any client could actually bind to such an Intent.

In the other direction
- BinderServerTransport's remote is a `BoundClientAddress` wrapper around the client's uid, which makes sense.
- BinderClientTransport's local is another case of `AndroidComponentAddress.forContext()` called on the client's source Context. This address is meaningless because it can't

This asymmetry is one of the reasons why AbstractTransportTest.socketStats() currently fails.

We could fix this by letting BinderClientTransport's local be a `BoundClientAddress` wrapper around its own UID.

I don't know what to do about BinderServerTransport's local. The client's actual bind Intent *is* mostly available from onBind() but we encourage Services to ignore it and always return the same `BinderServer.getHostBinder()`.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start by comparing address handling in BinderClientTransport and BinderServerTransport, then run AbstractTransportTest.socketStats() to reproduce the asymmetry. Review AndroidComponentAddress and BoundClientAddress usage, and resolve what each transport should report for local and remote addresses so the test's socket statistics expectations are consistent.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, java
Ambito
mobile-dev, networking
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
30/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.