| 100 | } |
| 101 | |
| 102 | bool stream::set_rw_timeout(int n, bool use_sockopt /* false */) |
| 103 | { |
| 104 | if (!stream_) { |
| 105 | return false; |
| 106 | } |
| 107 | |
| 108 | if (!use_sockopt) { |
| 109 | stream_->rw_timeout = n; |
| 110 | return true; |
| 111 | } |
| 112 | |
| 113 | stream_->rw_timeout = -1; |
| 114 | |
| 115 | if (!set_sockopt_timeo(ACL_VSTREAM_SOCK(stream_), SO_RCVTIMEO, n)) { |
| 116 | return false; |
| 117 | } |
| 118 | |
| 119 | return set_sockopt_timeo(ACL_VSTREAM_SOCK(stream_), SO_SNDTIMEO, n); |
| 120 | } |
| 121 | |
| 122 | void stream::set_time_unit(time_unit_t unit) { |
| 123 | if (stream_) { |