Making Arduino Yun WiFi connection reset

I trying the following scheme to ensure the stable WiFi connection with Yun device.

  1. on connection failure : reboot Yun (WiFi core)
  2. set the bridge started variable to 0
  3. begin the bridge again

bridge lib change :

//extern Serial_ Serial; //for debugging

void BridgeClass::begin() {
char c;

if (started) {
uint8_t quit_cmd = {'X', 'X', 'X', 'X', 'X'};
max_retries = 1;
transfer(quit_cmd, 5);


stream.println("boot"); //in case we are in the bootloader
stream.println("reboot"); //in case we are in the shell

started = true;


// Wait for U-boot to finish startup
//while(stream.readBytes(&c, 1)) Serial.print(c); //for debugging
while(stream.readBytes(&c, 1));