Skip to content

Commit cc05933

Browse files
committed
Undo synchronization change just to keep the PR smaller
1 parent 5703688 commit cc05933

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

binder/src/main/java/io/grpc/binder/internal/BinderTransport.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,9 @@ private boolean handleTransactionInternal(int code, Parcel parcel) {
488488
}
489489
numIncomingBytes += size;
490490
if ((numIncomingBytes - acknowledgedIncomingBytes) > TRANSACTION_BYTES_WINDOW_FORCE_ACK) {
491-
sendAcknowledgeBytes(checkNotNull(outgoingBinder), numIncomingBytes);
491+
synchronized (this) {
492+
sendAcknowledgeBytes(checkNotNull(outgoingBinder), numIncomingBytes);
493+
}
492494
acknowledgedIncomingBytes = numIncomingBytes;
493495
}
494496
return true;
@@ -520,15 +522,14 @@ private final void handlePing(Parcel requestParcel) {
520522
@GuardedBy("this")
521523
protected void handlePingResponse(Parcel parcel) {}
522524

525+
@GuardedBy("this")
523526
private void sendAcknowledgeBytes(OneWayBinderProxy iBinder, long n) {
524527
// Send a transaction to acknowledge reception of incoming data.
525528
try (ParcelHolder parcel = ParcelHolder.obtain()) {
526529
parcel.get().writeLong(n);
527530
iBinder.transact(ACKNOWLEDGE_BYTES, parcel);
528531
} catch (RemoteException re) {
529-
synchronized (this) {
530-
shutdownInternal(statusFromRemoteException(re), true);
531-
}
532+
shutdownInternal(statusFromRemoteException(re), true);
532533
}
533534
}
534535

0 commit comments

Comments
 (0)