On Mon Sep 23, 2019 at 5:50 PM joe mcguckin wrote:
> In ListenAndServe, I see that it calls (*Server).Serve(ln), then 'go 
> c.serve(ctx)' 
> I can't find a function named 'serve'. Where is this?

On line 1760 of the same file, server.go.

> Does HTTP manage a pool of coroutines or does it create one for every 
> incoming HTTP request.

A new goroutine is created to handle each connection from the listener.

> It's clear where the first request gets handled
> but where do subsequent requests get handled?

Subsequent requests get handled in the same manner. Note that `go
c.serve(ctx)` is in a loop which blocks waiting for a new connection
(with `l.Accept()`). Once the goroutine has been dispatched to handle
the request, the main goroutine returns to waiting for the next request.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/BX7VZ4GS19W8.39TY5199T9JP%40jupiter.local.

Reply via email to