package main import ( "bufio" "fmt" "net" ) func runServer(listenAddr string) error { serverSocket, err := net.Listen("tcp", listenAddr) if err != nil { myError := fmt.Errorf("could not create listening socket: %s", err.Error()) return myError } logger.Infof("Now listening for incoming connections.\n") defer serverSocket.Close() for { clientConnection, err := serverSocket.Accept() if err != nil { logger.Warnf("Could not accept client connection: %s\n", err.Error()) } else { logger.Infof("Accepted client connection.\n") milterReadWriter := bufio.NewReadWriter(bufio.NewReader(clientConnection), bufio.NewWriter(clientConnection)) go handleMtaConnection(milterReadWriter) } } }