| 9 | |
| 10 | namespace et { |
| 11 | UserTerminalHandler::UserTerminalHandler( |
| 12 | shared_ptr<SocketHandler> _socketHandler, shared_ptr<UserTerminal> _term, |
| 13 | bool _noratelimit, const optional<SocketEndpoint> routerEndpoint, |
| 14 | const string &idPasskey) |
| 15 | : socketHandler(_socketHandler), |
| 16 | term(_term), |
| 17 | noratelimit(_noratelimit), |
| 18 | shuttingDown(false) { |
| 19 | auto idpasskey_splited = split(idPasskey, '/'); |
| 20 | string id = idpasskey_splited[0]; |
| 21 | string passkey = idpasskey_splited[1]; |
| 22 | TerminalUserInfo tui; |
| 23 | tui.set_id(id); |
| 24 | tui.set_passkey(passkey); |
| 25 | tui.set_uid(getuid()); |
| 26 | tui.set_gid(getgid()); |
| 27 | |
| 28 | routerFd = ServerFifoPath::detectAndConnect(routerEndpoint, socketHandler); |
| 29 | |
| 30 | try { |
| 31 | socketHandler->writePacket( |
| 32 | routerFd, |
| 33 | Packet(TerminalPacketType::TERMINAL_USER_INFO, protoToString(tui))); |
| 34 | |
| 35 | } catch (const std::runtime_error &re) { |
| 36 | STFATAL << "Error connecting to router: " << re.what(); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | void UserTerminalHandler::run() { |
| 41 | while (true) { |
nothing calls this directly
no test coverage detected