Added devp-deploy to rbd-exporter
This commit is contained in:
@@ -10,23 +10,46 @@ import (
|
||||
)
|
||||
|
||||
func echo(c net.Conn, shout string, t time.Duration) {
|
||||
fmt.Fprintln(c, "\t", strings.ToUpper(shout))
|
||||
time.Sleep(t)
|
||||
fmt.Fprintln(c, "\t", shout)
|
||||
time.Sleep(t)
|
||||
fmt.Fprintln(c, "\t", strings.ToLower(shout))
|
||||
for _ = range 3 {
|
||||
fmt.Fprintln(c, "\t", strings.ToUpper(shout))
|
||||
time.Sleep(t)
|
||||
}
|
||||
}
|
||||
|
||||
func handleConn(conn net.Conn) {
|
||||
|
||||
count := 1
|
||||
defer fmt.Println("CLosed Connection")
|
||||
defer conn.Close()
|
||||
|
||||
fmt.Println("Accepted connection")
|
||||
|
||||
ticker := time.NewTicker(2*time.Second)
|
||||
|
||||
input := bufio.NewScanner(conn)
|
||||
for input.Scan() {
|
||||
go echo(conn, input.Text(), 1*time.Second)
|
||||
select {
|
||||
case <- ticker.C:
|
||||
fmt.Println("TIMEOUT")
|
||||
default:
|
||||
fmt.Println("DEFAULT")
|
||||
}
|
||||
|
||||
for input.Scan() {
|
||||
fmt.Println("TICK")
|
||||
switch input.Text() {
|
||||
case "info":
|
||||
fmt.Printf("INFO %d",count)
|
||||
default:
|
||||
count++
|
||||
go func() {
|
||||
defer func (){
|
||||
count--
|
||||
}()
|
||||
echo(conn, input.Text(), 1*time.Second)
|
||||
}()
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
Reference in New Issue
Block a user