| 141 | } |
| 142 | |
| 143 | client *replicaFromMaster(redisMaster *mi) |
| 144 | { |
| 145 | if (mi->master == nullptr) |
| 146 | return nullptr; |
| 147 | |
| 148 | listIter liReplica; |
| 149 | listNode *lnReplica; |
| 150 | listRewind(g_pserver->slaves, &liReplica); |
| 151 | while ((lnReplica = listNext(&liReplica)) != nullptr) |
| 152 | { |
| 153 | client *replica = (client*)listNodeValue(lnReplica); |
| 154 | if (FSameHost(mi->master, replica)) |
| 155 | return replica; |
| 156 | } |
| 157 | return nullptr; |
| 158 | } |
| 159 | |
| 160 | /* Plain unlink() can block for quite some time in order to actually apply |
| 161 | * the file deletion to the filesystem. This call removes the file in a |
no test coverage detected