11use crate :: gateway:: demux:: Demuxer ;
22use pulsebeam_runtime:: actor:: { ActorKind , ActorStatus , RunnerConfig } ;
33use pulsebeam_runtime:: prelude:: * ;
4- use pulsebeam_runtime:: { actor, mailbox , net} ;
4+ use pulsebeam_runtime:: { actor, net} ;
55use std:: { io, sync:: Arc } ;
66use tokio:: task:: JoinSet ;
77
88#[ derive( Clone ) ]
99pub enum GatewayControlMessage {
10- AddParticipant ( String , mailbox:: Sender < net:: RecvPacketBatch > ) ,
10+ AddParticipant (
11+ String ,
12+ pulsebeam_runtime:: sync:: mpsc:: Sender < net:: RecvPacketBatch > ,
13+ ) ,
1114 RemoveParticipant ( String ) ,
1215}
1316
@@ -154,7 +157,8 @@ impl GatewayWorkerActor {
154157 }
155158
156159 async fn read_socket ( & mut self ) -> io:: Result < ( ) > {
157- const COOP_BUDGET : usize = 128 ;
160+ // ~1,000 yields per second = ~99% CPU for other work
161+ const COOP_BUDGET : usize = 256 ;
158162 let mut spent_budget: usize = 0 ;
159163
160164 loop {
@@ -171,7 +175,7 @@ impl GatewayWorkerActor {
171175 } ;
172176
173177 let src = batch. src ;
174- if !self . demuxer . demux ( & mut self . socket , batch) . await {
178+ if !self . demuxer . demux ( & mut self . socket , batch) {
175179 // In case there's a malicious actor, close immediately as there's no
176180 // associated participant.
177181 self . socket . close_peer ( & src) ;
0 commit comments