Skip to content

Instantly share code, notes, and snippets.

@rueian
Last active February 12, 2022 02:01
Show Gist options
  • Save rueian/7a9a63dc27b5f9378e3520af3b0f03ba to your computer and use it in GitHub Desktop.
Save rueian/7a9a63dc27b5f9378e3520af3b0f03ba to your computer and use it in GitHub Desktop.
func reading(incoming *bufio.Reader, waiting <-chan request) error {
for {
resp, err := readResponse(incoming)
if err != nil {
return err
}
if req := <-waiting; req.caller != nil {
req.caller <- resp
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment