2016-07-26 14:41:11 +00:00
|
|
|
From 9fcf3200342603e9aa86a4bd3ba62f890237a200 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
|
Date: Tue, 26 Jul 2016 12:58:46 +0200
|
|
|
|
Subject: [PATCH] nghttpx: avoid using std::function to fix crash on armv7hl
|
|
|
|
|
|
|
|
Bug: https://bugzilla.redhat.com/1358845
|
|
|
|
---
|
|
|
|
src/shrpx_client_handler.cc | 8 ++++----
|
|
|
|
src/shrpx_client_handler.h | 6 ++++--
|
|
|
|
src/shrpx_http_downstream_connection.cc | 6 +++---
|
|
|
|
src/shrpx_http_downstream_connection.h | 5 +++--
|
|
|
|
4 files changed, 14 insertions(+), 11 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/src/shrpx_client_handler.cc b/src/shrpx_client_handler.cc
|
|
|
|
index 2c9b2a1..890143e 100644
|
|
|
|
--- a/src/shrpx_client_handler.cc
|
|
|
|
+++ b/src/shrpx_client_handler.cc
|
2017-04-24 14:09:08 +00:00
|
|
|
@@ -650,12 +650,12 @@ int ClientHandler::validate_next_proto() {
|
2016-07-26 14:41:11 +00:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
-int ClientHandler::do_read() { return read_(*this); }
|
|
|
|
-int ClientHandler::do_write() { return write_(*this); }
|
|
|
|
+int ClientHandler::do_read() { return (this->*read_)(); }
|
|
|
|
+int ClientHandler::do_write() { return (this->*write_)(); }
|
|
|
|
|
|
|
|
int ClientHandler::on_read() {
|
2017-01-25 12:12:09 +00:00
|
|
|
if (rb_.chunk_avail()) {
|
|
|
|
- auto rv = on_read_(*this);
|
|
|
|
+ auto rv = (this->*on_read_)();
|
|
|
|
if (rv != 0) {
|
|
|
|
return rv;
|
|
|
|
}
|
2017-04-24 14:09:08 +00:00
|
|
|
@@ -663,7 +663,7 @@ int ClientHandler::on_read() {
|
2016-07-26 14:41:11 +00:00
|
|
|
conn_.handle_tls_pending_read();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
-int ClientHandler::on_write() { return on_write_(*this); }
|
|
|
|
+int ClientHandler::on_write() { return (this->*on_write_)(); }
|
|
|
|
|
2016-10-24 12:35:56 +00:00
|
|
|
const StringRef &ClientHandler::get_ipaddr() const { return ipaddr_; }
|
2016-07-26 14:41:11 +00:00
|
|
|
|
|
|
|
diff --git a/src/shrpx_client_handler.h b/src/shrpx_client_handler.h
|
|
|
|
index bdfdafd..08f42b3 100644
|
|
|
|
--- a/src/shrpx_client_handler.h
|
|
|
|
+++ b/src/shrpx_client_handler.h
|
2017-03-27 14:25:55 +00:00
|
|
|
@@ -185,8 +185,10 @@ private:
|
2016-10-24 12:35:56 +00:00
|
|
|
StringRef forwarded_for_;
|
2016-09-26 10:37:48 +00:00
|
|
|
// lowercased TLS SNI which client sent.
|
2016-10-24 12:35:56 +00:00
|
|
|
StringRef sni_;
|
2016-07-26 14:41:11 +00:00
|
|
|
- std::function<int(ClientHandler &)> read_, write_;
|
|
|
|
- std::function<int(ClientHandler &)> on_read_, on_write_;
|
|
|
|
+ int (ClientHandler::*read_)();
|
|
|
|
+ int (ClientHandler::*write_)();
|
|
|
|
+ int (ClientHandler::*on_read_)();
|
|
|
|
+ int (ClientHandler::*on_write_)();
|
|
|
|
// Address of frontend listening socket
|
|
|
|
const UpstreamAddr *faddr_;
|
|
|
|
Worker *worker_;
|
|
|
|
diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc
|
|
|
|
index 077844c..8a38788 100644
|
|
|
|
--- a/src/shrpx_http_downstream_connection.cc
|
|
|
|
+++ b/src/shrpx_http_downstream_connection.cc
|
2017-05-27 20:49:07 +00:00
|
|
|
@@ -1464,13 +1464,13 @@ int HttpDownstreamConnection::connected() {
|
2016-07-26 14:41:11 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-01-25 12:12:09 +00:00
|
|
|
-int HttpDownstreamConnection::on_read() { return on_read_(*this); }
|
|
|
|
+int HttpDownstreamConnection::on_read() { return (this->*on_read_)(); }
|
2016-07-26 14:41:11 +00:00
|
|
|
|
2017-01-25 12:12:09 +00:00
|
|
|
-int HttpDownstreamConnection::on_write() { return on_write_(*this); }
|
|
|
|
+int HttpDownstreamConnection::on_write() { return (this->*on_write_)(); }
|
2016-07-26 14:41:11 +00:00
|
|
|
|
|
|
|
void HttpDownstreamConnection::on_upstream_change(Upstream *upstream) {}
|
|
|
|
|
2017-01-25 12:12:09 +00:00
|
|
|
-void HttpDownstreamConnection::signal_write() { signal_write_(*this); }
|
|
|
|
+void HttpDownstreamConnection::signal_write() { (this->*signal_write_)(); }
|
2016-07-26 14:41:11 +00:00
|
|
|
|
|
|
|
int HttpDownstreamConnection::actual_signal_write() {
|
|
|
|
ev_feed_event(conn_.loop, &conn_.wev, EV_WRITE);
|
|
|
|
diff --git a/src/shrpx_http_downstream_connection.h b/src/shrpx_http_downstream_connection.h
|
|
|
|
index 8fad535..0ab430c 100644
|
|
|
|
--- a/src/shrpx_http_downstream_connection.h
|
|
|
|
+++ b/src/shrpx_http_downstream_connection.h
|
2016-12-27 20:08:13 +00:00
|
|
|
@@ -91,8 +91,9 @@ public:
|
2016-07-26 14:41:11 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Connection conn_;
|
2017-01-25 12:12:09 +00:00
|
|
|
- std::function<int(HttpDownstreamConnection &)> on_read_, on_write_,
|
|
|
|
- signal_write_;
|
|
|
|
+ int (HttpDownstreamConnection::*on_read_)();
|
|
|
|
+ int (HttpDownstreamConnection::*on_write_)();
|
|
|
|
+ int (HttpDownstreamConnection::*signal_write_)();
|
2016-07-26 14:41:11 +00:00
|
|
|
Worker *worker_;
|
|
|
|
// nullptr if TLS is not used.
|
|
|
|
SSL_CTX *ssl_ctx_;
|
|
|
|
--
|
|
|
|
2.5.5
|
|
|
|
|