ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.46k stars 889 forks source link

shutdown before close #347

Open kgbook opened 4 years ago

kgbook commented 4 years ago

Tick value is 5 second by default, timer will expire if interval betweent two request is larger than 5 seconds.

Server will close the socket if timer is expired, but Client still send HTTP request to the socket. the length of data usingasync_read_some from the socket is 0, HTTP request from client skipped, and callback will not invoke!

It's ok if shutdown before close, so Client will receive FIN and close the socket, then start 3-way handshake.

Have tested using tcpdump and Wireshark.

boost/asio/basic_socket.hpp also recommend to shutdown before close, reference below:

@note For portable behaviour with respect to graceful closure of a connected socket, call shutdown() before closing the socket.