diff --git a/fsp.go b/fsp.go index 43459e6..0c4fc48 100644 --- a/fsp.go +++ b/fsp.go @@ -62,14 +62,11 @@ func (fs *FspServer) handleConnection(conn *net.TCPConn) { if !ok { return } - case <-fs.timeout(time.Second * 2): + case <-time.After(time.Second * 2): log.Println("Timeout reading from", conn.RemoteAddr().String()) return } - - w := bufio.NewWriterSize(conn, len(fs.policyData)) - w.Write(fs.policyData) - w.Flush() + conn.Write(fs.policyData) log.Println("Sent policy file to", conn.RemoteAddr().String()) } @@ -89,12 +86,3 @@ func (fs *FspServer) read(conn *net.TCPConn) (c chan bool) { }() return } - -func (fs *FspServer) timeout(d time.Duration) (c chan bool) { - c = make(chan bool) - go func() { - time.Sleep(d) - c <- true - }() - return -}