mirror of
https://github.com/moparisthebest/spdylay
synced 2024-12-22 07:38:52 -05:00
shrpx: Fix backend SPDY connection does not go through proxy
This commit is contained in:
parent
bae80e5667
commit
78523c6701
@ -78,6 +78,12 @@ int SpdySession::disconnect()
|
|||||||
SSL_shutdown(ssl_);
|
SSL_shutdown(ssl_);
|
||||||
}
|
}
|
||||||
if(bev_) {
|
if(bev_) {
|
||||||
|
int fd = bufferevent_getfd(bev_);
|
||||||
|
if(fd != -1 && fd_ == -1) {
|
||||||
|
fd_ = fd;
|
||||||
|
} else if(fd != -1 && fd_ != -1) {
|
||||||
|
assert(fd == fd_);
|
||||||
|
}
|
||||||
bufferevent_disable(bev_, EV_READ | EV_WRITE);
|
bufferevent_disable(bev_, EV_READ | EV_WRITE);
|
||||||
bufferevent_free(bev_);
|
bufferevent_free(bev_);
|
||||||
bev_ = 0;
|
bev_ = 0;
|
||||||
@ -273,8 +279,8 @@ void proxy_readcb(bufferevent *bev, void *ptr)
|
|||||||
switch(spdy->get_state()) {
|
switch(spdy->get_state()) {
|
||||||
case SpdySession::PROXY_CONNECTED:
|
case SpdySession::PROXY_CONNECTED:
|
||||||
// The current bufferevent is no longer necessary, so delete it
|
// The current bufferevent is no longer necessary, so delete it
|
||||||
// here.
|
// here. But we keep fd_ inside it.
|
||||||
spdy->free_bev();
|
spdy->unwrap_free_bev();
|
||||||
// Initiate SSL/TLS handshake through established tunnel.
|
// Initiate SSL/TLS handshake through established tunnel.
|
||||||
spdy->initiate_connection();
|
spdy->initiate_connection();
|
||||||
break;
|
break;
|
||||||
@ -420,8 +426,10 @@ int SpdySession::initiate_connection()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpdySession::free_bev()
|
void SpdySession::unwrap_free_bev()
|
||||||
{
|
{
|
||||||
|
assert(fd_ == -1);
|
||||||
|
fd_ = bufferevent_getfd(bev_);
|
||||||
bufferevent_free(bev_);
|
bufferevent_free(bev_);
|
||||||
bev_ = 0;
|
bev_ = 0;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public:
|
|||||||
void notify();
|
void notify();
|
||||||
|
|
||||||
bufferevent* get_bev() const;
|
bufferevent* get_bev() const;
|
||||||
void free_bev();
|
void unwrap_free_bev();
|
||||||
|
|
||||||
int get_state() const;
|
int get_state() const;
|
||||||
void set_state(int state);
|
void set_state(int state);
|
||||||
|
Loading…
Reference in New Issue
Block a user