func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) {
	var count int
	var bufWriter = bufio.NewWriter(conn)
	for {
		var res = <-responses
		err := types.WriteMessage(res, bufWriter)
		if err != nil {
			closeConn <- fmt.Errorf("Error writing message: %v", err.Error())
			return
		}
		if _, ok := res.Value.(*types.Response_Flush); ok {
			err = bufWriter.Flush()
			if err != nil {
				closeConn <- fmt.Errorf("Error flushing write buffer: %v", err.Error())
				return
			}
		}
		count++
	}
}
// Pull responses from 'responses' and write them to conn.
Pull responses from 'responses' and write them to conn.
// Pull responses from ' responses ' and write them to conn .
func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) {
	var count int
	var bufWriter = bufio.NewWriter(conn)
	for {
		var res = <-responses
		err := types.WriteMessage(res, bufWriter)
		if err != nil {
			closeConn <- fmt.Errorf("Error writing message: %v", err.Error())
			return
		}
		if _, ok := res.Value.(*types.Response_Flush); ok {
			err = bufWriter.Flush()
			if err != nil {
				closeConn <- fmt.Errorf("Error flushing write buffer: %v", err.Error())
				return
			}
		}
		count++
	}
}
func ( s * SocketServer ) handleResponses ( closeConn chan error , conn net . Conn , responses <- chan * types . Response ) { var count int var bufWriter = bufio . NewWriter ( conn ) for { var res = <- responses err := types . WriteMessage ( res , bufWriter ) if err != nil { closeConn <- fmt . Errorf ( " " , err . Error ( ) ) return } if _ , ok := res . Value . ( * types . Response_Flush ) ; ok { err = bufWriter . Flush ( ) if err != nil { closeConn <- fmt . Errorf ( " " , err . Error ( ) ) return } } count ++ } }
Pull responses from 'responses' and write them to conn.
Pull responses from ' responses ' and write them to conn .