Synchronization of complex dynamical networks under recoverable attacks