2021-11-08 18:25:28 +00:00
|
|
|
package g0;
|
|
|
|
|
2021-12-21 23:37:30 +00:00
|
|
|
import b.d.b.a.a;
|
|
|
|
import b.i.a.f.e.o.f;
|
2021-11-08 18:25:28 +00:00
|
|
|
import d0.z.d.m;
|
|
|
|
import java.io.IOException;
|
|
|
|
/* compiled from: AsyncTimeout.kt */
|
2022-03-02 20:59:20 +00:00
|
|
|
/* loaded from: classes3.dex */
|
2021-11-08 18:25:28 +00:00
|
|
|
public final class c implements v {
|
2021-12-17 22:03:14 +00:00
|
|
|
public final /* synthetic */ b j;
|
|
|
|
public final /* synthetic */ v k;
|
2021-11-08 18:25:28 +00:00
|
|
|
|
|
|
|
public c(b bVar, v vVar) {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.j = bVar;
|
|
|
|
this.k = vVar;
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v, java.io.Closeable, java.lang.AutoCloseable
|
|
|
|
public void close() {
|
2021-12-17 22:03:14 +00:00
|
|
|
b bVar = this.j;
|
2021-11-08 18:25:28 +00:00
|
|
|
bVar.i();
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k.close();
|
2021-11-08 18:25:28 +00:00
|
|
|
if (bVar.j()) {
|
|
|
|
throw bVar.k(null);
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
2022-03-02 20:59:20 +00:00
|
|
|
if (bVar.j()) {
|
|
|
|
throw bVar.k(e);
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
bVar.j();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v, java.io.Flushable
|
|
|
|
public void flush() {
|
2021-12-17 22:03:14 +00:00
|
|
|
b bVar = this.j;
|
2021-11-08 18:25:28 +00:00
|
|
|
bVar.i();
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k.flush();
|
2021-11-08 18:25:28 +00:00
|
|
|
if (bVar.j()) {
|
|
|
|
throw bVar.k(null);
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
2022-03-02 20:59:20 +00:00
|
|
|
if (bVar.j()) {
|
|
|
|
throw bVar.k(e);
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
bVar.j();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v
|
|
|
|
public y timeout() {
|
2021-12-17 22:03:14 +00:00
|
|
|
return this.j;
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
2022-03-30 16:43:10 +00:00
|
|
|
StringBuilder R = a.R("AsyncTimeout.sink(");
|
|
|
|
R.append(this.k);
|
|
|
|
R.append(')');
|
|
|
|
return R.toString();
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // g0.v
|
|
|
|
public void write(e eVar, long j) {
|
|
|
|
m.checkParameterIsNotNull(eVar, "source");
|
2022-03-02 20:59:20 +00:00
|
|
|
f.B(eVar.k, 0L, j);
|
2021-11-08 18:25:28 +00:00
|
|
|
while (true) {
|
|
|
|
long j2 = 0;
|
|
|
|
if (j > 0) {
|
2021-12-17 22:03:14 +00:00
|
|
|
s sVar = eVar.j;
|
2021-11-08 18:25:28 +00:00
|
|
|
if (sVar == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
|
|
|
while (true) {
|
2022-03-02 20:59:20 +00:00
|
|
|
if (j2 >= 65536) {
|
2021-11-08 18:25:28 +00:00
|
|
|
break;
|
|
|
|
}
|
2022-03-30 16:43:10 +00:00
|
|
|
j2 += sVar.c - sVar.f3675b;
|
2021-11-08 18:25:28 +00:00
|
|
|
if (j2 >= j) {
|
|
|
|
j2 = j;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sVar = sVar.f;
|
|
|
|
if (sVar == null) {
|
|
|
|
m.throwNpe();
|
|
|
|
}
|
|
|
|
}
|
2021-12-17 22:03:14 +00:00
|
|
|
b bVar = this.j;
|
2021-11-08 18:25:28 +00:00
|
|
|
bVar.i();
|
|
|
|
try {
|
2021-12-17 22:03:14 +00:00
|
|
|
this.k.write(eVar, j2);
|
2021-11-08 18:25:28 +00:00
|
|
|
if (!bVar.j()) {
|
|
|
|
j -= j2;
|
|
|
|
} else {
|
|
|
|
throw bVar.k(null);
|
|
|
|
}
|
|
|
|
} catch (IOException e) {
|
2022-03-02 20:59:20 +00:00
|
|
|
if (bVar.j()) {
|
|
|
|
throw bVar.k(e);
|
2021-11-08 18:25:28 +00:00
|
|
|
}
|
2022-03-02 20:59:20 +00:00
|
|
|
throw e;
|
2021-11-08 18:25:28 +00:00
|
|
|
} finally {
|
|
|
|
bVar.j();
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|