todo:http 写文件的bug。
This commit is contained in:
@@ -500,7 +500,7 @@ static void __stream_bev_writecb(struct bufferevent * bev, void * arg)
|
||||
struct evbuffer * __output_buffer = bufferevent_get_output(bev);
|
||||
assert(__output_buffer != NULL);
|
||||
|
||||
if (*ref_peer_conn == NULL && evbuffer_get_length(__output_buffer) == 0)
|
||||
if (*ref_peer_conn == NULL && (*ref_this_conn)->on_writing == 0 && evbuffer_get_length(__output_buffer) == 0)
|
||||
{
|
||||
__conn_private_destory_with_ssl(ev_base, *ref_this_conn, *ref_this_ssl_stream);
|
||||
*ref_this_conn = NULL;
|
||||
@@ -529,12 +529,14 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void *
|
||||
struct ssl_stream ** ref_this_ssl_stream{};
|
||||
struct ssl_stream ** ref_peer_ssl_stream{};
|
||||
|
||||
const char * __str_dir = NULL;
|
||||
if (__bev_dir(_stream, bev) == CONN_DIR_UPSTREAM)
|
||||
{
|
||||
ref_this_conn = &_stream->conn_upstream;
|
||||
ref_peer_conn = &_stream->conn_downstream;
|
||||
ref_this_ssl_stream = &_stream->ssl_upstream;
|
||||
ref_peer_ssl_stream = &_stream->ssl_downstream;
|
||||
__str_dir = "up";
|
||||
}
|
||||
|
||||
if (__bev_dir(_stream, bev) == CONN_DIR_DOWNSTREAM)
|
||||
@@ -543,6 +545,7 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void *
|
||||
ref_peer_conn = &_stream->conn_upstream;
|
||||
ref_this_ssl_stream = &_stream->ssl_downstream;
|
||||
ref_peer_ssl_stream = &_stream->ssl_upstream;
|
||||
__str_dir = "down";
|
||||
}
|
||||
|
||||
if (events & BEV_EVENT_ERROR || events & BEV_EVENT_EOF)
|
||||
@@ -552,6 +555,7 @@ static void __stream_bev_eventcb(struct bufferevent * bev, short events, void *
|
||||
__stream_bev_readcb(bev, arg);
|
||||
}
|
||||
|
||||
fprintf(stderr, "---- eventcb ----, stream = %p, event = %x, dir = %s\n", _stream, events, __str_dir);
|
||||
goto __close_connection;
|
||||
}
|
||||
|
||||
@@ -563,7 +567,7 @@ __close_connection:
|
||||
struct bufferevent * __peer_bev = (*ref_peer_conn)->bev;
|
||||
struct evbuffer * __peer_output_buffer = bufferevent_get_output(__peer_bev);
|
||||
|
||||
if (evbuffer_get_length(__peer_output_buffer) == 0)
|
||||
if (evbuffer_get_length(__peer_output_buffer) == 0 && (*ref_peer_conn)->on_writing == 0)
|
||||
{
|
||||
__conn_private_destory_with_ssl(ev_base, *ref_peer_conn, *ref_peer_ssl_stream);
|
||||
*ref_peer_conn = NULL;
|
||||
@@ -573,6 +577,9 @@ __close_connection:
|
||||
|
||||
if (*ref_this_conn != NULL)
|
||||
{
|
||||
fprintf(stderr, "---- eventcb ----, close this connection, stream = %p, event = %x, dir = %s\n", _stream, events, __str_dir);
|
||||
|
||||
assert((*ref_this_conn)->on_writing == 0);
|
||||
__conn_private_destory_with_ssl(ev_base, *ref_this_conn, *ref_this_ssl_stream);
|
||||
*ref_this_conn = NULL;
|
||||
*ref_this_ssl_stream = NULL;
|
||||
|
||||
Reference in New Issue
Block a user