فهرست منبع

Move ws::WebSocket's chrono set_read_timeout into the header half

Defined next to its non-template overload, it landed in the part of the header
that test_split compiles into httplib.cc, leaving a user TU's instantiation
with nothing to link against. The WebSocketClient overload of the same name has
always sat up with the class definitions; this one belongs there too.

Only test_split sees it -- a header-only build instantiates the template
wherever it is written, which is why the regular test target stayed green.
yhirose 1 ماه پیش
والد
کامیت
d5f8858731
1فایلهای تغییر یافته به همراه7 افزوده شده و 7 حذف شده
  1. 7 7
      httplib.h

+ 7 - 7
httplib.h

@@ -4602,6 +4602,13 @@ private:
 #endif
 };
 
+template <class Rep, class Period>
+inline void
+WebSocket::set_read_timeout(const std::chrono::duration<Rep, Period> &duration) {
+  detail::duration_to_sec_and_usec(
+      duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); });
+}
+
 template <class Rep, class Period>
 inline void WebSocketClient::set_read_timeout(
     const std::chrono::duration<Rep, Period> &duration) {
@@ -22457,13 +22464,6 @@ inline void WebSocket::set_read_timeout(time_t sec, time_t usec) {
   strm_.set_read_timeout(sec, usec);
 }
 
-template <class Rep, class Period>
-inline void WebSocket::set_read_timeout(
-    const std::chrono::duration<Rep, Period> &duration) {
-  detail::duration_to_sec_and_usec(
-      duration, [&](time_t sec, time_t usec) { set_read_timeout(sec, usec); });
-}
-
 // WebSocketClient implementation
 inline WebSocketClient::WebSocketClient(
     const std::string &scheme_host_port_path, const Headers &headers)