瀏覽代碼

ProtocolServer: Port to socket takeover

Sergey Bugaev 5 年之前
父節點
當前提交
9eaac26eda
共有 3 個文件被更改,包括 4 次插入3 次删除
  1. 1 0
      Base/etc/SystemServer.ini
  2. 1 1
      Libraries/LibProtocol/Client.cpp
  3. 2 2
      Servers/ProtocolServer/main.cpp

+ 1 - 0
Base/etc/SystemServer.ini

@@ -5,6 +5,7 @@ StdIO=/dev/tty1
 Priority=high
 Priority=high
 
 
 [ProtocolServer]
 [ProtocolServer]
+Socket=/tmp/portal/protocol
 Priority=low
 Priority=low
 KeepAlive=1
 KeepAlive=1
 User=anon
 User=anon

+ 1 - 1
Libraries/LibProtocol/Client.cpp

@@ -5,7 +5,7 @@
 namespace LibProtocol {
 namespace LibProtocol {
 
 
 Client::Client()
 Client::Client()
-    : ConnectionNG(*this, "/tmp/psportal")
+    : ConnectionNG(*this, "/tmp/portal/protocol")
 {
 {
     handshake();
     handshake();
 }
 }

+ 2 - 2
Servers/ProtocolServer/main.cpp

@@ -9,8 +9,8 @@ int main(int, char**)
     CEventLoop event_loop;
     CEventLoop event_loop;
     (void)*new HttpProtocol;
     (void)*new HttpProtocol;
     auto server = CLocalServer::construct();
     auto server = CLocalServer::construct();
-    unlink("/tmp/psportal");
-    server->listen("/tmp/psportal");
+    bool ok = server->take_over_from_system_server();
+    ASSERT(ok);
     server->on_ready_to_accept = [&] {
     server->on_ready_to_accept = [&] {
         auto client_socket = server->accept();
         auto client_socket = server->accept();
         if (!client_socket) {
         if (!client_socket) {