[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r28177 - libmicrohttpd/src/microspdy
From: |
gnunet |
Subject: |
[GNUnet-SVN] r28177 - libmicrohttpd/src/microspdy |
Date: |
Thu, 18 Jul 2013 23:44:38 +0200 |
Author: andreyu
Date: 2013-07-18 23:44:37 +0200 (Thu, 18 Jul 2013)
New Revision: 28177
Modified:
libmicrohttpd/src/microspdy/session.c
libmicrohttpd/src/microspdy/session.h
Log:
spdy: send RST_STREAM when user callback for response fails
Modified: libmicrohttpd/src/microspdy/session.c
===================================================================
--- libmicrohttpd/src/microspdy/session.c 2013-07-18 21:12:21 UTC (rev
28176)
+++ libmicrohttpd/src/microspdy/session.c 2013-07-18 21:44:37 UTC (rev
28177)
@@ -129,7 +129,7 @@
if(0 == name_value_strm_size || 0 == compressed_data_size)
{
//Protocol error: send RST_STREAM
- if(SPDY_YES != SPDYF_prepare_rst_stream(session,
session->current_stream_id,
+ if(SPDY_YES != SPDYF_prepare_rst_stream(session,
session->streams_head,
SPDY_RST_STREAM_STATUS_PROTOCOL_ERROR))
{
//no memory, try later to send RST
@@ -571,11 +571,22 @@
if(ret < 0 || ret > response_queue->response->rcb_block_size)
{
- //TODO send RST_STREAM (app error)
+ free(session->write_buffer);
+ session->write_buffer = NULL;
+
+ //send RST_STREAM
+ if(SPDY_YES == (ret = SPDYF_prepare_rst_stream(session,
+ response_queue->stream,
+ SPDY_RST_STREAM_STATUS_INTERNAL_ERROR)))
+ {
+ return SPDY_NO;
+ }
+
+ //else no memory
//for now close session
+ //TODO what?
session->status = SPDY_SESSION_STATUS_CLOSING;
- free(session->write_buffer);
return SPDY_NO;
}
if(0 == ret && more)
@@ -619,6 +630,7 @@
session->status = SPDY_SESSION_STATUS_CLOSING;
free(session->write_buffer);
+ session->write_buffer = NULL;
return SPDY_NO;
}
@@ -992,7 +1004,7 @@
if(session->write_buffer_beginning ==
session->write_buffer_size)
{
//that response is handled, remove it from queue
- free(session->write_buffer);
+ free(session->write_buffer);
session->write_buffer = NULL;
session->write_buffer_size = 0;
queue_head = session->response_queue_head;
@@ -1175,7 +1187,7 @@
session->read_buffer_beginning
= session->read_buffer_offset;
SPDYF_prepare_rst_stream(session,
-
session->current_stream_id, //may be 0 here which is not good
+
session->current_stream_id > 0 ? session->streams_head : NULL, //may be 0 here
which is not good
SPDY_RST_STREAM_STATUS_FRAME_TOO_LARGE);
//actually the read buffer can
be bigger than the
@@ -1541,13 +1553,19 @@
int
SPDYF_prepare_rst_stream (struct SPDY_Session *session,
- uint32_t stream_id,
+ struct SPDYF_Stream * stream,
enum SPDY_RST_STREAM_STATUS status)
{
struct SPDYF_Response_Queue *response_to_queue;
struct SPDYF_Control_Frame *control_frame;
uint32_t *data;
+ uint32_t stream_id;
+ if(NULL == stream)
+ stream_id = 0;
+ else
+ stream_id = stream->stream_id;
+
if(NULL == (response_to_queue = malloc(sizeof(struct
SPDYF_Response_Queue))))
{
return SPDY_NO;
@@ -1579,6 +1597,7 @@
response_to_queue->process_response_handler =
&SPDYF_handler_write_rst_stream;
response_to_queue->data = data;
response_to_queue->data_size = 8;
+ response_to_queue->stream = stream;
SPDYF_queue_response (response_to_queue,
session,
Modified: libmicrohttpd/src/microspdy/session.h
===================================================================
--- libmicrohttpd/src/microspdy/session.h 2013-07-18 21:12:21 UTC (rev
28176)
+++ libmicrohttpd/src/microspdy/session.h 2013-07-18 21:44:37 UTC (rev
28177)
@@ -160,14 +160,14 @@
* will be discarded soon.
*
* @param session SPDY session
- * @param stream_id stream to terminate
+ * @param stream stream to terminate
* @param status code for the RST_STREAM frame
* @return SPDY_NO on memory error or
* SPDY_YES on success
*/
int
SPDYF_prepare_rst_stream (struct SPDY_Session *session,
- uint32_t stream_id,
+ struct SPDYF_Stream * stream,
enum SPDY_RST_STREAM_STATUS status);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r28177 - libmicrohttpd/src/microspdy,
gnunet <=