summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-18 16:39:22 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-18 16:39:22 (GMT)
commit61c1a7078ba21c4e12bfbacb368ba7e87263248a (patch)
treeb7bd58e9904df9f49534022ddb0dd2ddc907f857 /src
parenta8483937bc06458979d01d0aa60721c081aede10 (diff)
added client handler for telnet control interface
Diffstat (limited to 'src')
-rw-r--r--src/helsinki.at/rhimportd/ctrlTelnet.go23
1 files changed, 23 insertions, 0 deletions
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)
+ }
}