[BACK]Return to tcp.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / external / mpl / bind / dist / lib / isc / netmgr

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/external/mpl/bind/dist/lib/isc/netmgr/tcp.c between version 1.1.1.3 and 1.1.1.4

version 1.1.1.3, 2021/02/19 16:37:17 version 1.1.1.4, 2021/04/29 16:46:32
Line 89  static void
Line 89  static void
 stop_tcp_child(isc_nmsocket_t *sock);  stop_tcp_child(isc_nmsocket_t *sock);
   
 static void  static void
 start_sock_timer(isc_nmsocket_t *sock);  
   
 static void  
 start_reading(isc_nmsocket_t *sock);  start_reading(isc_nmsocket_t *sock);
   
 static void  static void
Line 718  destroy:
Line 715  destroy:
         }          }
 }  }
   
   void
   isc__nm_tcp_failed_read_cb(isc_nmsocket_t *sock, isc_result_t result) {
           failed_read_cb(sock, result);
   }
   
 static void  static void
 failed_send_cb(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,  failed_send_cb(isc_nmsocket_t *sock, isc__nm_uvreq_t *req,
                isc_result_t eresult) {                 isc_result_t eresult) {
Line 725  failed_send_cb(isc_nmsocket_t *sock, isc
Line 727  failed_send_cb(isc_nmsocket_t *sock, isc
         REQUIRE(VALID_UVREQ(req));          REQUIRE(VALID_UVREQ(req));
   
         if (req->cb.send != NULL) {          if (req->cb.send != NULL) {
                 isc__nm_sendcb(sock, req, eresult);                  isc__nm_sendcb(sock, req, eresult, true);
         } else {          } else {
                 isc__nm_uvreq_put(&req, sock);                  isc__nm_uvreq_put(&req, sock);
         }          }
Line 744  get_read_req(isc_nmsocket_t *sock) {
Line 746  get_read_req(isc_nmsocket_t *sock) {
 }  }
   
 static void  static void
 readtimeout_cb(uv_timer_t *timer) {  
         isc_nmsocket_t *sock = uv_handle_get_data((uv_handle_t *)timer);  
   
         REQUIRE(VALID_NMSOCK(sock));  
         REQUIRE(sock->tid == isc_nm_tid());  
         REQUIRE(sock->reading);  
   
         /*  
          * Timeout; stop reading and process whatever we have.  
          */  
         failed_read_cb(sock, ISC_R_TIMEDOUT);  
 }  
   
 static void  
 start_sock_timer(isc_nmsocket_t *sock) {  
         if (sock->read_timeout > 0) {  
                 int r = uv_timer_start(&sock->timer, readtimeout_cb,  
                                        sock->read_timeout, 0);  
                 REQUIRE(r == 0);  
         }  
 }  
   
 static void  
 stop_sock_timer(isc_nmsocket_t *sock) {  
         int r = uv_timer_stop(&sock->timer);  
         REQUIRE(r == 0);  
 }  
   
 static void  
 start_reading(isc_nmsocket_t *sock) {  start_reading(isc_nmsocket_t *sock) {
         if (sock->reading) {          if (sock->reading) {
                 return;                  return;
Line 781  start_reading(isc_nmsocket_t *sock) {
Line 754  start_reading(isc_nmsocket_t *sock) {
         int r = uv_read_start(&sock->uv_handle.stream, tcp_alloc_cb, read_cb);          int r = uv_read_start(&sock->uv_handle.stream, tcp_alloc_cb, read_cb);
         REQUIRE(r == 0);          REQUIRE(r == 0);
         sock->reading = true;          sock->reading = true;
   
         start_sock_timer(sock);  
 }  }
   
 static void  static void
Line 795  stop_reading(isc_nmsocket_t *sock) {
Line 766  stop_reading(isc_nmsocket_t *sock) {
         REQUIRE(r == 0);          REQUIRE(r == 0);
         sock->reading = false;          sock->reading = false;
   
         stop_sock_timer(sock);          isc__nmsocket_timer_stop(sock);
 }  }
   
 void  void
Line 878  isc__nm_async_tcpstartread(isc__networke
Line 849  isc__nm_async_tcpstartread(isc__networke
         }          }
   
         start_reading(sock);          start_reading(sock);
           isc__nmsocket_timer_start(sock);
 }  }
   
 void  void
Line 996  read_cb(uv_stream_t *stream, ssize_t nre
Line 968  read_cb(uv_stream_t *stream, ssize_t nre
         /* The readcb could have paused the reading */          /* The readcb could have paused the reading */
         if (sock->reading) {          if (sock->reading) {
                 /* The timer will be updated */                  /* The timer will be updated */
                 start_sock_timer(sock);                  isc__nmsocket_timer_restart(sock);
         }          }
   
 free:  free:
Line 1198  tcp_send_cb(uv_write_t *req, int status)
Line 1170  tcp_send_cb(uv_write_t *req, int status)
                 return;                  return;
         }          }
   
         isc__nm_sendcb(sock, uvreq, ISC_R_SUCCESS);          isc__nm_sendcb(sock, uvreq, ISC_R_SUCCESS, false);
 }  }
   
 /*  /*
Line 1478  isc__nm_async_tcpcancel(isc__networker_t
Line 1450  isc__nm_async_tcpcancel(isc__networker_t
         failed_read_cb(sock, ISC_R_EOF);          failed_read_cb(sock, ISC_R_EOF);
 }  }
   
 void  
 isc__nm_tcp_settimeout(isc_nmhandle_t *handle, uint32_t timeout) {  
         isc_nmsocket_t *sock = NULL;  
   
         REQUIRE(VALID_NMHANDLE(handle));  
   
         sock = handle->sock;  
   
         sock->read_timeout = timeout;  
         if (uv_is_active((uv_handle_t *)&sock->timer)) {  
                 start_sock_timer(sock);  
         }  
 }  
   
 int_fast32_t  int_fast32_t
 isc__nm_tcp_listener_nactive(isc_nmsocket_t *listener) {  isc__nm_tcp_listener_nactive(isc_nmsocket_t *listener) {
         int_fast32_t nactive;          int_fast32_t nactive;

Legend:
Removed from v.1.1.1.3  
changed lines
  Added in v.1.1.1.4

CVSweb <webmaster@jp.NetBSD.org>