Esp8266 communication with arduino

start to move forward little modified the code and again question about Serial.

small note mySerial and Serial are same in this code #defined mySerial Serial

//void sendcommand function everything is same except commented lines

for (byte i = 0; i < (strlen(_command)); i++) {
    mySerial.write(_command[i]);
    delay(1);
  }
  mySerial.flush(); //added output buffer flush for arduino to wait till output buffer will be empty then do whatever suppose to do.

this is init function which now sends command via function then checks response via other function

send_command(restart);
  success &= receive_command("OK");
  serial_flush();

send_command(bla);
  success &= receive_command("OK");
  serial_flush();
  Serial.println(success);

changed receive function completely

bool receive_command(char answer[]) {
  unsigned long _time = 0;
  const int max_time = 10000; 
  bool flag = 0;


  _time = millis();
  Serial.println(Serial.available()); // Attention to this line!

  while (Serial.available() < 2) { // waiting for buffer to be at least 2 byte
    if ((millis() - _time) > max_time) return flag; // can wait for max_time
  }

  do {
 //delay(10); this delay is correcting that 32byte problem.
    _time = millis(); //update timer
    if (Serial.findUntil(answer, '\n')) return flag = 1; // if answer is found within terminating char exit
  } while (Serial.available() && (millis() - _time) < max_time); // do while Serial.available returns !0 and time is within reasonable limit.

  return flag; // will return 0 anyway.

}

and serial input buffer flush

void serial_flush(void) {
  while (Serial.available()) Serial.read();
}

now I`m sending this string via serial monitor
saodijosadifjasodifjaosi;djfaosidfj
OKsdoifja;osidjf;oaisjdf;oiasjdf

right after OK if you count there are 30 chars in red plus CR and LF i.e. 32byte.

when second send command is executed sending "bla" that 32 bytes are still in input buffer . and it automatically receives wrong string. I.e. leftover from first one which flush function supposed to clean.

If I am adding delay of 10 milliseconds in receive function . that 32 bytes are emptied.

why I need to slow things down to flush the buffer? Can someone read the code and pinpoint where I`m going wrong again ?
thanks