Revision 5cdf8383 mongoose.c

View differences:

mongoose.c
7796 7796
    case MG_EV_CONNECT:
7797 7797
    case MG_EV_POLL:
7798 7798
      if (req->retries > req->max_retries) {
7799
        req->callback(NULL, req->data);
7800
        MG_FREE(req);
7801 7799
        nc->flags |= MG_F_CLOSE_IMMEDIATELY;
7802 7800
        break;
7803 7801
      }
......
7812 7810
      if (mg_parse_dns(nc->recv_mbuf.buf, *(int *) data, msg) == 0 &&
7813 7811
          msg->num_answers > 0) {
7814 7812
        req->callback(msg, req->data);
7815
      } else {
7816
        req->callback(NULL, req->data);
7813
        nc->user_data = NULL;
7814
        MG_FREE(req);
7817 7815
      }
7818
      MG_FREE(req);
7819 7816
      MG_FREE(msg);
7820 7817
      nc->flags |= MG_F_CLOSE_IMMEDIATELY;
7821 7818
      break;
7819
    case MG_EV_SEND:
7820
      /*
7821
       * If a send error occurs, prevent closing of the connection by the core.
7822
       * We will retry after timeout.
7823
       */
7824
      nc->flags &= ~MG_F_CLOSE_IMMEDIATELY;
7825
      mbuf_remove(&nc->send_mbuf, nc->send_mbuf.len);
7826
      break;
7827
    case MG_EV_CLOSE:
7828
      /* If we got here with request still not done, fire an error callback. */
7829
      if (req != NULL) {
7830
        req->callback(NULL, req->data);
7831
        nc->user_data = NULL;
7832
        MG_FREE(req);
7833
      }
7834
      break;
7822 7835
  }
7823 7836
}
7824 7837

  

Also available in: Unified diff