Browse code

dsync中に不要なオブジェクトが残ってしまう不具合を修正

Masanobu Yasui authored on 2014/12/09 21:54:10
Showing 1 changed files
... ...
@@ -1219,6 +1219,8 @@ static void mrecv_req_del_open(mdata *data, struct sockaddr_in *addr)
1219 1219
   uint16_t len;
1220 1220
   uint32_t mod;
1221 1221
   mfile *a = mkack(data, addr, MAKUO_RECVSTATE_OPEN);
1222
+  mfile *m = mrecv_req_search(data, addr);
1223
+  mhost *t = member_get(&(addr->sin_addr));
1222 1224
   char path[PATH_MAX];
1223 1225
 
1224 1226
   if(!a){
... ...
@@ -1247,6 +1249,19 @@ static void mrecv_req_del_open(mdata *data, struct sockaddr_in *addr)
1247 1247
 #endif
1248 1248
   }
1249 1249
   msend(a);
1250
+
1251
+  if(m){
1252
+    return;
1253
+  }
1254
+  m = mfadd(MFRECV);
1255
+  m->mdata.head.opcode = data->head.opcode;
1256
+  m->mdata.head.reqid  = data->head.reqid;
1257
+  m->mdata.head.nstate = MAKUO_RECVSTATE_OPEN;
1258
+  memcpy(&(m->addr), addr, sizeof(m->addr));
1259
+  mtimeget(&(m->lastrecv));
1260
+  if(data->head.flags & MAKUO_FLAG_DRYRUN){
1261
+    m->dryrun = 1;
1262
+  }
1250 1263
 }
1251 1264
 
1252 1265
 static void mrecv_req_del_data_report(mfile *m, mcomm *c, uint32_t err, char *hn, char *path)
... ...
@@ -1277,21 +1292,15 @@ static void mrecv_req_del_data(mdata *data, struct sockaddr_in *addr)
1277 1277
   char path[PATH_MAX];
1278 1278
 
1279 1279
   msend(mkack(data, addr, MAKUO_RECVSTATE_OPEN));
1280
-  if(m){
1280
+  if(!m){
1281
+    return;
1282
+  }
1283
+  if(m->mdata.head.nstate != MAKUO_RECVSTATE_OPEN){
1281 1284
     return;
1282 1285
   }
1283 1286
   if(t){
1284 1287
     hn = t->hostname;
1285 1288
   }
1286
-  m = mfadd(MFRECV);
1287
-  m->mdata.head.opcode = data->head.opcode;
1288
-  m->mdata.head.reqid  = data->head.reqid;
1289
-  m->mdata.head.nstate = MAKUO_RECVSTATE_OPEN;
1290
-  memcpy(&(m->addr), addr, sizeof(m->addr));
1291
-  mtimeget(&(m->lastrecv));
1292
-  if(data->head.flags & MAKUO_FLAG_DRYRUN){
1293
-    m->dryrun = 1;
1294
-  }
1295 1289
   for(a=mftop[MFSEND];a;a=a->next){
1296 1290
     if((a->mdata.head.reqid == data->head.seqno) && (a->comm != NULL)){
1297 1291
       c = a->comm;
... ...
@@ -1306,6 +1315,8 @@ static void mrecv_req_del_data(mdata *data, struct sockaddr_in *addr)
1306 1306
     path[len] =  0;
1307 1307
     mrecv_req_del_data_report(m, c, err, hn, path);
1308 1308
   }
1309
+  m->mdata.head.ostate = m->mdata.head.nstate;
1310
+  m->mdata.head.nstate = MAKUO_RECVSTATE_CLOSE;
1309 1311
 }
1310 1312
 
1311 1313
 static void mrecv_req_del_close(mdata *data, struct sockaddr_in *addr)