| 40 | } |
| 41 | |
| 42 | ~TPortGuard() override { |
| 43 | try { |
| 44 | if (!NFs::Remove(Lock_->GetName())) { |
| 45 | // Deletion may fail if the current user does not have |
| 46 | // write permission to the PORT_SYNC_PATH directory. |
| 47 | // At least let's release the lock file. |
| 48 | Lock_->Release(); |
| 49 | } |
| 50 | } catch (const TSystemError& e) { |
| 51 | Y_ABORT("Failed to unlock port %d, error=%d", Port_, e.Status()); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | ui16 Get() override { |
| 56 | return Port_; |