File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,12 +42,12 @@ pub fn main() {
4242 stratus . Binary ( _msg ) -> stratus . continue ( state )
4343 stratus . User ( Close ) -> {
4444 let assert Ok ( _ ) =
45- stratus . close_with_reason ( conn , stratus . GoingAway ( << "goodbye" >> ) )
45+ stratus . close ( conn , stratus . GoingAway ( << "goodbye" >> ) )
4646 stratus . stop ( )
4747 }
4848 }
4949 } )
50- |> stratus . on_close ( fn ( _state ) { io . println ( "oh noooo" ) } )
50+ |> stratus . on_close ( fn ( _state , _reason ) { io . println ( "oh noooo" ) } )
5151 |> stratus . start
5252
5353 let timer =
Original file line number Diff line number Diff line change @@ -157,6 +157,7 @@ pub opaque type InternalMessage(user_message) {
157157 Err ( SocketReason )
158158 Data ( BitArray )
159159 Closed ( CloseReason )
160+ Ready
160161 Shutdown
161162}
162163
@@ -322,13 +323,6 @@ pub fn start(
322323
323324 let context_takeovers = websocket . get_context_takeovers ( extensions )
324325
325- let assert Ok ( _ ) =
326- transport . set_opts (
327- transport ,
328- handshake_response . socket ,
329- socket . convert_options ( [ Receive ( Once ) ] ) ,
330- )
331-
332326 actor . new_with_initialiser ( 1000 , fn ( subject ) {
333327 let started_selector = process . select ( process . new_selector ( ) , subject )
334328 logging . log ( logging . Debug , "Calling user initializer" )
@@ -358,6 +352,7 @@ pub fn start(
358352 True -> Some ( compression . init ( context_takeovers ) )
359353 False -> None
360354 }
355+ process . send ( subject , Ready )
361356 State (
362357 buffer : << >> ,
363358 incomplete : None ,
@@ -373,6 +368,15 @@ pub fn start(
373368 } )
374369 |> actor . on_message ( fn ( state , message ) {
375370 case message {
371+ Ready -> {
372+ let assert Ok ( _ ) =
373+ transport . set_opts (
374+ transport ,
375+ handshake_response . socket ,
376+ socket . convert_options ( [ Receive ( Once ) ] ) ,
377+ )
378+ actor . continue ( state )
379+ }
376380 UserMessage ( user_message ) -> {
377381 let conn =
378382 Connection (
You can’t perform that action at this time.
0 commit comments