- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for sleepNanos (0.06 sec)
-
mockwebserver/src/main/kotlin/mockwebserver3/internal/SleepNanos.kt
* See the License for the specific language governing permissions and * limitations under the License. * */ package mockwebserver3.internal internal fun sleepNanos(nanos: Long) { val ms = nanos / 1_000_000L val ns = nanos - (ms * 1_000_000L) if (ms > 0L || nanos > 0) { Thread.sleep(ms, ns.toInt()) }
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Jan 07 16:05:34 UTC 2024 - 811 bytes - Viewed (0) -
mockwebserver/src/main/kotlin/mockwebserver3/internal/ThrottledSink.kt
source: Buffer, byteCount: Long, ) { var bytesLeft = byteCount while (bytesLeft > 0) { if (bytesWrittenSinceLastDelay == bytesPerPeriod) { flush() sleepNanos(periodDelayNanos) bytesWrittenSinceLastDelay = 0 } val toWrite = minOf(bytesLeft, bytesPerPeriod - bytesWrittenSinceLastDelay) bytesWrittenSinceLastDelay += toWrite bytesLeft -= toWrite
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Mon Jan 08 01:13:22 UTC 2024 - 1.5K bytes - Viewed (0) -
mockwebserver/src/main/kotlin/mockwebserver3/MockWebServer.kt
socket: Socket, sink: BufferedSink, response: MockResponse, ) { sleepNanos(response.headersDelayNanos) sink.writeUtf8(response.status) sink.writeUtf8("\r\n") writeHeaders(sink, response.headers) val body = response.body ?: return sleepNanos(response.bodyDelayNanos) val responseBodySink = sink.withThrottlingAndSocketPolicy(
Registered: Fri Nov 01 11:42:11 UTC 2024 - Last Modified: Sun Mar 31 17:16:15 UTC 2024 - 37.4K bytes - Viewed (0)