@@ -30,14 +30,14 @@ const _BACKLOG_DEFAULT = 511
3030mutable struct Connection{S}
3131 const server:: S # Server{F, C}
3232 const h1conn:: Any # AwsHTTP.H1Connection or AwsHTTP.H2Connection
33- const channel :: Any # Reseau.Channel
33+ const pipeline :: Any # Reseau.PipelineState
3434 const streams_lock:: ReentrantLock
3535 const streams:: Set{Stream}
3636 const remote_addr:: String
3737 const remote_port_num:: Int
3838
39- Connection (server:: S , h1conn, channel , remote_addr:: String , remote_port_num:: Int ) where {S} =
40- new {S} (server, h1conn, channel , ReentrantLock (), Set {Stream} (), remote_addr, remote_port_num)
39+ Connection (server:: S , h1conn, pipeline , remote_addr:: String , remote_port_num:: Int ) where {S} =
40+ new {S} (server, h1conn, pipeline , ReentrantLock (), Set {Stream} (), remote_addr, remote_port_num)
4141end
4242
4343Base. hash (c:: Connection , h:: UInt ) = hash (objectid (c), h)
@@ -267,7 +267,7 @@ function _create_request_handler!(conn::Connection, aws_conn; http2::Bool=false)
267267 end
268268 end
269269 if shutdown_channel
270- Reseau. Sockets. channel_shutdown ! (conn. channel ; shutdown_immediately= true )
270+ Reseau. Sockets. pipeline_shutdown ! (conn. pipeline ; shutdown_immediately= true )
271271 @lock server. connections_lock begin
272272 delete! (server. connections, conn)
273273 end
@@ -395,28 +395,26 @@ function serve!(f, host="127.0.0.1", port=8080;
395395 )
396396 alpn_list = _tls_alpn_list (tls_conn_opts)
397397 initial_window = Csize_t (min (UInt64 (initial_window_size), UInt64 (typemax (Csize_t))))
398- on_incoming_channel_setup = (bootstrap, error_code, channel , user_data) -> begin
398+ on_incoming_channel_setup = (bootstrap, error_code, pipeline , user_data) -> begin
399399 Base. CoreLogging. with_logstate (server. logstate) do
400400 if error_code != 0
401401 @error " incoming channel setup error" error_code
402402 return
403403 end
404404 st = @atomic (server. state)
405405 if st == :closing || st == :closed
406- Reseau. Sockets. channel_shutdown! (channel ; shutdown_immediately= true )
406+ Reseau. Sockets. pipeline_shutdown! (pipeline ; shutdown_immediately= true )
407407 return
408408 end
409- slot = Reseau. Sockets. channel_slot_new! (channel)
410- Reseau. Sockets. channel_slot_insert_end! (channel, slot)
411409 version = AwsHTTP. HttpVersion. HTTP_1_1
412410 if tls_conn_opts != = nothing
413- tls_slot = slot . adj_left
414- if tls_slot === nothing || tls_slot . handler === nothing || ! (tls_slot . handler isa Reseau . Sockets . TlsChannelHandler)
411+ tls_handler = pipeline . tls_handler
412+ if tls_handler === nothing
415413 @error " incoming channel setup error" error_code= Reseau. ERROR_INVALID_STATE
416- Reseau. Sockets. channel_shutdown! (channel , Reseau. ERROR_INVALID_STATE)
414+ Reseau. Sockets. pipeline_shutdown! (pipeline , Reseau. ERROR_INVALID_STATE)
417415 return
418416 end
419- protocol = Reseau. Sockets. tls_handler_protocol (tls_slot . handler )
417+ protocol = Reseau. Sockets. tls_handler_protocol (tls_handler )
420418 if protocol. len > 0
421419 protocol_str = Reseau. byte_buffer_as_string (protocol)
422420 if protocol_str == " h2"
@@ -426,26 +424,28 @@ function serve!(f, host="127.0.0.1", port=8080;
426424 end
427425 end
428426 end
429- http_conn = AwsHTTP. http_connection_new_channel_handler (;
427+ http_conn = AwsHTTP. http_connection_new_handler (;
430428 is_server= true ,
431429 version= version,
432430 initial_window_size= initial_window,
433431 )
434432 http_conn === nothing && return
435- Reseau. Sockets. channel_slot_set_handler! (slot, http_conn)
436- http_conn. slot = slot
437- # Extract remote endpoint from the socket handler (first slot in pipeline)
433+ if version == AwsHTTP. HttpVersion. HTTP_2
434+ AwsHTTP. h2_connection_install! (http_conn, pipeline, pipeline. socket)
435+ else
436+ AwsHTTP. h1_connection_install! (http_conn, pipeline, pipeline. socket)
437+ end
438438 remote_addr = " 0.0.0.0"
439439 remote_port_num = 0
440440 try
441- socket_handler = channel . first . handler
442- ep = socket_handler . socket. remote_endpoint
441+ socket = pipeline . socket
442+ ep = socket. remote_endpoint
443443 remote_addr = Reseau. Sockets. get_address (ep)
444444 remote_port_num = Int (ep. port)
445445 catch
446446 end
447447 http_conn. remote_endpoint = " $remote_addr :$remote_port_num "
448- conn = Connection (server, http_conn, channel , remote_addr, remote_port_num)
448+ conn = Connection (server, http_conn, pipeline , remote_addr, remote_port_num)
449449 @lock server. connections_lock begin
450450 push! (server. connections, conn)
451451 end
@@ -470,26 +470,26 @@ function serve!(f, host="127.0.0.1", port=8080;
470470 else
471471 _create_request_handler! (conn, http_conn; http2= false )
472472 end
473- if Reseau. Sockets. channel_thread_is_callers_thread (channel )
474- Reseau. Sockets. channel_trigger_read (channel )
473+ if Reseau. Sockets. pipeline_thread_is_callers_thread (pipeline )
474+ Reseau. Sockets. pipeline_trigger_read (pipeline . socket )
475475 else
476476 task = Reseau. Sockets. ChannelTask (Reseau. EventCallable (status -> begin
477477 Reseau. TaskStatus. T (status) == Reseau. TaskStatus. RUN_READY || return nothing
478- Reseau. Sockets. channel_trigger_read (channel )
478+ Reseau. Sockets. pipeline_trigger_read (pipeline . socket )
479479 return nothing
480480 end ), " http_server_trigger_read" )
481- Reseau. Sockets. channel_schedule_task_now! (channel , task)
481+ Reseau. Sockets. pipeline_schedule_task_now! (pipeline , task)
482482 end
483483 end
484484 return
485485 end
486- on_incoming_channel_shutdown = (bootstrap, error_code, channel , user_data) -> begin
486+ on_incoming_channel_shutdown = (bootstrap, error_code, pipeline , user_data) -> begin
487487 Base. CoreLogging. with_logstate (server. logstate) do
488488 if _should_log_channel_shutdown_error (error_code)
489489 @error " incoming channel shutdown error" error_code
490490 end
491491 @lock server. connections_lock begin
492- filter! (c -> c. channel != = channel , server. connections)
492+ filter! (c -> c. pipeline != = pipeline , server. connections)
493493 end
494494 end
495495 return
@@ -633,7 +633,7 @@ function _forceclose!(server::Server; skip_shutdown::Bool=false)
633633 append! (conns, server. connections)
634634 end
635635 for conn in conns
636- Reseau. Sockets. channel_shutdown ! (conn. channel ; shutdown_immediately= true )
636+ Reseau. Sockets. pipeline_shutdown ! (conn. pipeline ; shutdown_immediately= true )
637637 end
638638 @atomic server. state = :closed
639639 notify (server. closed)
@@ -658,7 +658,7 @@ function Base.close(server::Server)
658658 _stop_new_requests! (conn)
659659 @lock conn. streams_lock begin
660660 if isempty (conn. streams)
661- Reseau. Sockets. channel_shutdown ! (conn. channel ; shutdown_immediately= true )
661+ Reseau. Sockets. pipeline_shutdown ! (conn. pipeline ; shutdown_immediately= true )
662662 @lock server. connections_lock begin
663663 delete! (server. connections, conn)
664664 end
0 commit comments