浏览代码

LibProtocol: Exit fatally if the connection to RequestServer disappears

The default implementation of die() causes the client process to simply
exit cleanly. This prevents any tests from recognizing that something
went wrong, as the process exits with a code of 0. With this patch, we
still just exit when the connection dies, but with a fatal signal. In
the future, we will want to launch a new RequestServer process and
re-establish client connections.
Timothy Flynn 1 年之前
父节点
当前提交
d1ec32e28f
共有 2 个文件被更改,包括 9 次插入0 次删除
  1. 7 0
      Userland/Libraries/LibProtocol/RequestClient.cpp
  2. 2 0
      Userland/Libraries/LibProtocol/RequestClient.h

+ 7 - 0
Userland/Libraries/LibProtocol/RequestClient.cpp

@@ -14,6 +14,13 @@ RequestClient::RequestClient(NonnullOwnPtr<Core::LocalSocket> socket)
 {
 {
 }
 }
 
 
+void RequestClient::die()
+{
+    // FIXME: Gracefully handle this, or relaunch and reconnect to RequestServer.
+    warnln("\033[31;1mLost connection to RequestServer\033[0m");
+    VERIFY_NOT_REACHED();
+}
+
 void RequestClient::ensure_connection(URL::URL const& url, ::RequestServer::CacheLevel cache_level)
 void RequestClient::ensure_connection(URL::URL const& url, ::RequestServer::CacheLevel cache_level)
 {
 {
     async_ensure_connection(url, cache_level);
     async_ensure_connection(url, cache_level);

+ 2 - 0
Userland/Libraries/LibProtocol/RequestClient.h

@@ -36,6 +36,8 @@ public:
     bool set_certificate(Badge<Request>, Request&, ByteString, ByteString);
     bool set_certificate(Badge<Request>, Request&, ByteString, ByteString);
 
 
 private:
 private:
+    virtual void die() override;
+
     virtual void request_started(i32, IPC::File const&) override;
     virtual void request_started(i32, IPC::File const&) override;
     virtual void request_progress(i32, Optional<u64> const&, u64) override;
     virtual void request_progress(i32, Optional<u64> const&, u64) override;
     virtual void request_finished(i32, bool, u64) override;
     virtual void request_finished(i32, bool, u64) override;