소스 검색

dialog: Correctly restore dialog lifetime from DB

Restore the lifetime to the configured value instead of the offset from the
time the reload from the DB took place.
Alex Hermann 11 년 전
부모
커밋
3d5f8af6ef
1개의 변경된 파일5개의 추가작업 그리고 3개의 파일을 삭제
  1. 5 3
      modules/dialog/dlg_db_handler.c

+ 5 - 3
modules/dialog/dlg_db_handler.c

@@ -383,11 +383,13 @@ static int load_dialog_info_from_db(int dlg_hash_size, int fetch_num_rows)
 			dlg->tl.timeout = (unsigned int)(VAL_INT(values+9));
 			LM_DBG("db dialog timeout is %u (%u/%u)\n", dlg->tl.timeout,
 					get_ticks(), (unsigned int)time(0));
-			if (dlg->tl.timeout<=(unsigned int)time(0))
+			if (dlg->tl.timeout<=(unsigned int)time(0)) {
 				dlg->tl.timeout = 0;
-			else
+				dlg->lifetime = 0;
+			} else {
+				dlg->lifetime = dlg->tl.timeout - dlg->start_ts;
 				dlg->tl.timeout -= (unsigned int)time(0);
-			dlg->lifetime = dlg->tl.timeout;
+			}
 
 			GET_STR_VALUE(cseq1, values, 10 , 1, 1);
 			GET_STR_VALUE(cseq2, values, 11 , 1, 1);