![]() |
master.cpp File Reference#include <ListenSocket.h> #include <signal.h> #include <StdoutLog.h> #include "MHandler.h" #include "MasterSocket.h" #include "ExtSocket.h" #include "AdminSocket.h" Include dependency graph for master.cpp: ![]() Go to the source code of this file.
Function Documentation
Definition at line 12 of file master.cpp. References MHandler::GetAdminPort(), MHandler::GetListenPort(), MHandler::LoadConfig(), MHandler::SaveConfig(), and MHandler::StartServices(). 00013 { 00014 StdoutLog log; 00015 MHandler h(&log); 00016 h.LoadConfig(); 00017 h.SaveConfig(); 00018 // 00019 signal(SIGPIPE, SIG_IGN); 00020 // 00021 ListenSocket<MasterSocket> l(h); 00022 if (l.Bind(h.GetListenPort())) 00023 { 00024 printf("Bind failed\n"); 00025 exit(-1); 00026 } 00027 printf("Listening for incoming slave connection on port %u\n", h.GetListenPort()); 00028 h.Add(&l); 00029 // 00030 /* 00031 ListenSocket<ProxyInSocket> l6(h); 00032 if (l6.Bind(h.GetProxyPort())) 00033 { 00034 printf("Bind failed\n"); 00035 exit(-1); 00036 } 00037 printf("HTTP proxy listening on port %u\n", h.GetProxyPort()); 00038 h.Add(&l6); 00039 */ 00040 ListenSocket<AdminSocket> l7(h); 00041 if (l7.Bind(h.GetAdminPort())) 00042 { 00043 printf("Bind on port %d failed\n", h.GetAdminPort()); 00044 exit(-1); 00045 } 00046 printf("Admin listening on port %u\n", h.GetAdminPort()); 00047 h.Add(&l7); 00048 // 00049 h.StartServices(); 00050 // 00051 while (true) 00052 { 00053 h.Select(1,0); 00054 } 00055 }
|