package main import ( "bufio" "net" "os" ) func runServer() { serverSocket, err := net.Listen("tcp", "127.0.0.1:7777") if err != nil { logger.Errorf("Could not create listening socket: %s\n", err.Error()) os.Exit(1) } else { 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) } } }