mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
Allow users to set allow_dirty_shutdown
This commit is contained in:
parent
f7eb69ace4
commit
099d27df2b
@ -313,7 +313,7 @@ struct bufferevent_openssl {
|
|||||||
unsigned read_blocked_on_write : 1;
|
unsigned read_blocked_on_write : 1;
|
||||||
/* When we next get data, we should say "write" instead of "read". */
|
/* When we next get data, we should say "write" instead of "read". */
|
||||||
unsigned write_blocked_on_read : 1;
|
unsigned write_blocked_on_read : 1;
|
||||||
/* XXX */
|
/* Treat TCP close before SSL close on SSL >= v3 as clean EOF. */
|
||||||
unsigned allow_dirty_shutdown : 1;
|
unsigned allow_dirty_shutdown : 1;
|
||||||
/* XXXX */
|
/* XXXX */
|
||||||
unsigned fd_is_set : 1;
|
unsigned fd_is_set : 1;
|
||||||
@ -1389,6 +1389,27 @@ bufferevent_openssl_socket_new(struct event_base *base,
|
|||||||
base, NULL, fd, ssl, state, options);
|
base, NULL, fd, ssl, state, options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev)
|
||||||
|
{
|
||||||
|
int allow_dirty_shutdown = 0;
|
||||||
|
struct bufferevent_openssl *bev_ssl;
|
||||||
|
BEV_LOCK(bev);
|
||||||
|
bev_ssl = upcast(bev);
|
||||||
|
allow_dirty_shutdown = bev_ssl->allow_dirty_shutdown;
|
||||||
|
BEV_UNLOCK(bev);
|
||||||
|
return allow_dirty_shutdown;
|
||||||
|
}
|
||||||
|
|
||||||
|
void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
|
||||||
|
int allow_dirty_shutdown)
|
||||||
|
{
|
||||||
|
struct bufferevent_openssl *bev_ssl;
|
||||||
|
BEV_LOCK(bev);
|
||||||
|
bev_ssl = upcast(bev);
|
||||||
|
bev_ssl->allow_dirty_shutdown = allow_dirty_shutdown;
|
||||||
|
BEV_UNLOCK(bev);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned long
|
unsigned long
|
||||||
bufferevent_get_openssl_error(struct bufferevent *bev)
|
bufferevent_get_openssl_error(struct bufferevent *bev)
|
||||||
{
|
{
|
||||||
|
@ -88,6 +88,22 @@ bufferevent_openssl_socket_new(struct event_base *base,
|
|||||||
enum bufferevent_ssl_state state,
|
enum bufferevent_ssl_state state,
|
||||||
int options);
|
int options);
|
||||||
|
|
||||||
|
/** Control whether to report dirty SSL shutdowns.
|
||||||
|
|
||||||
|
If the peer closes the TCP connection before closing the SSL channel, the
|
||||||
|
protocol is SSL >= v3, and allow_dirty_shutdown=0 (default), you will receive
|
||||||
|
BEV_EVENT_ERROR.
|
||||||
|
|
||||||
|
If instead allow_dirty_shutdown=1, you will receive BEV_EVENT_EOF.
|
||||||
|
|
||||||
|
On the other hand, if the protocol is < SSLv3, you will always receive
|
||||||
|
BEV_EVENT_EOF.
|
||||||
|
*/
|
||||||
|
|
||||||
|
int bufferevent_openssl_get_allow_dirty_shutdown(struct bufferevent *bev);
|
||||||
|
void bufferevent_openssl_set_allow_dirty_shutdown(struct bufferevent *bev,
|
||||||
|
int allow_dirty_shutdown);
|
||||||
|
|
||||||
/** Return the underlying openssl SSL * object for an SSL bufferevent. */
|
/** Return the underlying openssl SSL * object for an SSL bufferevent. */
|
||||||
struct ssl_st *
|
struct ssl_st *
|
||||||
bufferevent_openssl_get_ssl(struct bufferevent *bufev);
|
bufferevent_openssl_get_ssl(struct bufferevent *bufev);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user