shill: InputHandler: Add error callback
Input IOHandler owners now must supply a callback for handling
input exceptions. This allows individual modules to decide
whether or not this is a fatal error or not.
BUG=chromium-os:37415
TEST=New unit tests, Manual: Make sure HTTPProxy and HTTPRequest
continue to work normally
Change-Id: Idf9c106d5f2a4985fb4720f54ddb6d66c60f9173
Reviewed-on: https://gerrit.chromium.org/gerrit/40021
Commit-Queue: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/rtnl_handler.cc b/rtnl_handler.cc
index 19eb460..647a4a4 100644
--- a/rtnl_handler.cc
+++ b/rtnl_handler.cc
@@ -18,6 +18,7 @@
#include <base/bind.h>
+#include "shill/error.h"
#include "shill/event_dispatcher.h"
#include "shill/io_handler.h"
#include "shill/ip_address.h"
@@ -85,8 +86,10 @@
return;
}
- rtnl_handler_.reset(dispatcher->CreateInputHandler(rtnl_socket_,
- rtnl_callback_));
+ rtnl_handler_.reset(dispatcher->CreateInputHandler(
+ rtnl_socket_,
+ rtnl_callback_,
+ Bind(&RTNLHandler::OnReadError, Unretained(this))));
sockets_ = sockets;
NextRequest(last_dump_sequence_);
@@ -413,4 +416,9 @@
return true;
}
+void RTNLHandler::OnReadError(const Error &error) {
+ LOG(FATAL) << "RTNL Socket read returns error: "
+ << error.message();
+}
+
} // namespace shill