Пример #1
0
void spdylay_outbound_item_free(spdylay_outbound_item *item)
{
  if(item == NULL) {
    return;
  }
  if(item->frame_cat == SPDYLAY_CTRL) {
    spdylay_frame_type frame_type;
    spdylay_frame *frame;
    frame_type = spdylay_outbound_item_get_ctrl_frame_type(item);
    frame = spdylay_outbound_item_get_ctrl_frame(item);
    switch(frame_type) {
    case SPDYLAY_SYN_STREAM:
      spdylay_frame_syn_stream_free(&frame->syn_stream);
      free(((spdylay_syn_stream_aux_data*)item->aux_data)->data_prd);
      break;
    case SPDYLAY_SYN_REPLY:
      spdylay_frame_syn_reply_free(&frame->syn_reply);
      break;
    case SPDYLAY_RST_STREAM:
      spdylay_frame_rst_stream_free(&frame->rst_stream);
      break;
    case SPDYLAY_SETTINGS:
      spdylay_frame_settings_free(&frame->settings);
      break;
    case SPDYLAY_NOOP:
      /* We don't have any public API to add NOOP, so here is
         unreachable. */
      assert(0);
    case SPDYLAY_PING:
      spdylay_frame_ping_free(&frame->ping);
      break;
    case SPDYLAY_GOAWAY:
      spdylay_frame_goaway_free(&frame->goaway);
      break;
    case SPDYLAY_HEADERS:
      spdylay_frame_headers_free(&frame->headers);
      break;
    case SPDYLAY_WINDOW_UPDATE:
      spdylay_frame_window_update_free(&frame->window_update);
      break;
    case SPDYLAY_CREDENTIAL:
      assert(0);
      break;
    }
  } else if(item->frame_cat == SPDYLAY_DATA) {
    spdylay_data *data_frame;
    data_frame = spdylay_outbound_item_get_data_frame(item);
    spdylay_frame_data_free(data_frame);
  } else {
    /* Unreachable */
    assert(0);
  }
  free(item->frame);
  free(item->aux_data);
}
Пример #2
0
static void run_spdylay_frame_pack_goaway(void)
{
  spdylay_frame frame;
  uint8_t *buf = NULL;
  size_t buflen = 0;
  spdylay_frame_goaway_init(&frame.goaway, SPDYLAY_PROTO_SPDY3, 1000000007,
                            SPDYLAY_GOAWAY_PROTOCOL_ERROR);
  spdylay_frame_pack_goaway(&buf, &buflen, &frame.goaway);
  free(buf);
  spdylay_frame_goaway_free(&frame.goaway);
}
Пример #3
0
void spdylay_outbound_item_free(spdylay_outbound_item *item)
{
  if(item == NULL) {
    return;
  }
  switch(item->frame_type) {
  case SPDYLAY_SYN_STREAM:
    spdylay_frame_syn_stream_free(&item->frame->syn_stream);
    free(((spdylay_syn_stream_aux_data*)item->aux_data)->data_prd);
    break;
  case SPDYLAY_SYN_REPLY:
    spdylay_frame_syn_reply_free(&item->frame->syn_reply);
    break;
  case SPDYLAY_RST_STREAM:
    spdylay_frame_rst_stream_free(&item->frame->rst_stream);
    break;
  case SPDYLAY_SETTINGS:
    spdylay_frame_settings_free(&item->frame->settings);
    break;
  case SPDYLAY_NOOP:
    /* We don't have any public API to add NOOP, so here is
       unreachable. */
    abort();
  case SPDYLAY_PING:
    spdylay_frame_ping_free(&item->frame->ping);
    break;
  case SPDYLAY_GOAWAY:
    spdylay_frame_goaway_free(&item->frame->goaway);
    break;
  case SPDYLAY_HEADERS:
    spdylay_frame_headers_free(&item->frame->headers);
    break;
  case SPDYLAY_WINDOW_UPDATE:
    spdylay_frame_window_update_free(&item->frame->window_update);
    break;
  case SPDYLAY_DATA:
    spdylay_frame_data_free(&item->frame->data);
    break;
  }
  free(item->frame);
  free(item->aux_data);
}