From 61c1a7078ba21c4e12bfbacb368ba7e87263248a Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Fri, 18 Dec 2015 17:39:22 +0100 Subject: added client handler for telnet control interface diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go index 003c666..bcad22c 100644 --- a/src/helsinki.at/rhimportd/ctrlTelnet.go +++ b/src/helsinki.at/rhimportd/ctrlTelnet.go @@ -26,8 +26,31 @@ package main import ( "helsinki.at/rhimport" + "net" ) +func client_handler(conn net.Conn) { + defer conn.Close() + rhdl.Println("telnet-ctrl: new client from:", conn.RemoteAddr()) + +} + func StartControlTelnet(addr_s string, conf *rhimport.Config, rddb *rhimport.RdDb) { rhl.Println("telnet-ctrl: listening on", addr_s) + + server, err := net.Listen("tcp", addr_s) + if err != nil { + rhl.Println("telnet-ctrl: Listen() Error:", err) + return + } + + for { + conn, err := server.Accept() + if err != nil { + rhl.Println("telnet-ctrl: Accept() Error:", err) + return + } + + go client_handler(conn) + } } -- cgit v0.10.2