6161#include " flow/IUDPSocket.h"
6262#include " flow/IConnection.h"
6363
64- #include " flow/actorcompiler.h" // This must be the last #include.
65-
6664ISimulator* g_simulator = nullptr ;
6765thread_local ISimulator::ProcessInfo* ISimulator::currentProcess = nullptr ;
6866thread_local bool ISimulator::isMainThread = false ;
@@ -457,15 +455,15 @@ struct Sim2Conn final : IConnection, ReferenceCounted<Sim2Conn> {
457455 }
458456
459457 static Future<Void> sender (Sim2Conn* self) {
460- loop {
458+ while ( true ) {
461459 co_await self->writtenBytes .onChange (); // takes place on peer!
462460 ASSERT (g_simulator->getCurrentProcess () == self->peerProcess );
463461 co_await delay (.002 * deterministicRandom ()->random01 ());
464462 self->sentBytes .set (self->writtenBytes .get ()); // or possibly just some sometimes...
465463 }
466464 }
467465 static Future<Void> receiver (Sim2Conn* self) {
468- loop {
466+ while ( true ) {
469467 if (self->sentBytes .get () != self->receivedBytes .get ())
470468 co_await g_simulator->onProcess (self->peerProcess );
471469 while (self->sentBytes .get () == self->receivedBytes .get ())
@@ -502,7 +500,7 @@ struct Sim2Conn final : IConnection, ReferenceCounted<Sim2Conn> {
502500 }
503501 static Future<Void> whenReadable (Sim2Conn* self) {
504502 try {
505- loop {
503+ while ( true ) {
506504 if (self->readBytes .get () != self->receivedBytes .get ()) {
507505 ASSERT (g_simulator->getCurrentProcess () == self->process );
508506 co_return ;
@@ -517,7 +515,7 @@ struct Sim2Conn final : IConnection, ReferenceCounted<Sim2Conn> {
517515 }
518516 static Future<Void> whenWritable (Sim2Conn* self) {
519517 try {
520- loop {
518+ while ( true ) {
521519 if (!self->peer )
522520 co_return ;
523521 if (self->peer ->availableSendBufferForPeer () > 0 ) {
@@ -1221,7 +1219,7 @@ class Sim2 final : public ISimulator, public INetworkConnections {
12211219 }
12221220 static Future<Reference<IConnection>> waitForProcessAndConnect (NetworkAddress toAddr, INetworkConnections* self) {
12231221 // We have to be able to connect to processes that don't yet exist, so we do some silly polling
1224- loop {
1222+ while ( true ) {
12251223 co_await ::delay (0.1 * deterministicRandom ()->random01 ());
12261224 if (g_sim2.addressMap .contains (toAddr)) {
12271225 Reference<IConnection> c = co_await self->connect (toAddr);
0 commit comments