From: Josh G. <ja...@us...> - 2003-10-26 13:26:50
|
Update of /cvsroot/gift/OpenFT/src/proto In directory sc8-pr-cvs1:/tmp/cvs-serv23437/proto Modified Files: ft_sharing.c Log Message: gracefully refuse to insert or remove shares when the underlying database is not open, for whatever reason Index: ft_sharing.c =================================================================== RCS file: /cvsroot/gift/OpenFT/src/proto/ft_sharing.c,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ft_sharing.c 18 Oct 2003 00:13:34 -0000 1.11 --- ft_sharing.c 26 Oct 2003 13:23:17 -0000 1.12 *************** *** 260,270 **** BOOL ret; ! md5 = ft_packet_get_ustr (packet, 16); if (!(is_child (c))) { ! if (md5) ! ft_packet_sendva (c, FT_SHARE_ADD_ERROR, 0, "Ss", md5, 16, "NOT_CHILD"); return; } --- 260,278 ---- BOOL ret; ! if (!(md5 = ft_packet_get_ustr (packet, 16))) ! return; if (!(is_child (c))) { ! ft_packet_sendva (c, FT_SHARE_ADD_ERROR, 0, "Ss", md5, 16, "NOT_CHILD"); ! return; ! } + /* make sure the database has been opened before we attempt an insertion */ + if (!(ft_search_db_isopen (FT_NODE(c)))) + { + /* database wasn't opened...perhaps an error, perhaps this share is + * out-of-sync... */ + ft_packet_sendva (c, FT_SHARE_ADD_ERROR, 0, "Ss", md5, 16, "DB_NOT_OPEN"); return; } *************** *** 341,345 **** unsigned char *md5; ! if (!is_child (c)) return; --- 349,353 ---- unsigned char *md5; ! if (!(is_child (c)) || !(ft_search_db_isopen (FT_NODE(c)))) return; |