func connectionDispatcher(listener listener.TrudyListener, name string, show bool) { defer listener.Close() for { fd, conn, err := listener.Accept() if err != nil { continue } var p pipe.TrudyPipe if name == "TLS" { p = new(pipe.TLSPipe) err = p.New(connectionCount, fd, conn) } else { p = new(pipe.TCPPipe) err = p.New(connectionCount, fd, conn) } if err != nil { log.Println("[ERR] Error creating new pipe.") continue } if show { log.Printf("[INFO] ( %v ) %v Connection accepted!\n", connectionCount, name) } go clientHandler(p, show) go serverHandler(p) connectionCount++ } }