[vhffs-dev] [1539] by using shared file descriptors among multiples clients it appears that file descriptors were not properly closed when files are modified then moved to a file that is already being sent in a very very short period of time |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
- To: vhffs-dev@xxxxxxxxx
- Subject: [vhffs-dev] [1539] by using shared file descriptors among multiples clients it appears that file descriptors were not properly closed when files are modified then moved to a file that is already being sent in a very very short period of time
- From: subversion@xxxxxxxxxxxxx
- Date: Wed, 13 Jan 2010 02:18:48 +0100
Revision: 1539
Author: gradator
Date: 2010-01-13 02:18:47 +0100 (Wed, 13 Jan 2010)
Log Message:
-----------
by using shared file descriptors among multiples clients it appears that file descriptors were not properly closed when files are modified then moved to a file that is already being sent in a very very short period of time
Modified Paths:
--------------
trunk/vhffs-fssync/vhffsfssync_master.c
Modified: trunk/vhffs-fssync/vhffsfssync_master.c
===================================================================
--- trunk/vhffs-fssync/vhffsfssync_master.c 2010-01-10 19:29:24 UTC (rev 1538)
+++ trunk/vhffs-fssync/vhffsfssync_master.c 2010-01-13 01:18:47 UTC (rev 1539)
@@ -415,8 +415,6 @@
if(!file)
return -1;
- // if the file is being sent, cancel it
- vhffsfssync_net_remove_file(conn, pathname);
//printf("%d SENDING FILE %s\n", conn->fd, pathname);
vhffsfssync_net_send_event(conn, g_strdup_printf("open%c%s%c", '\0', pathname, '\0') , VHFFSFSSYNC_NET_PRIO_MEDIUM);
vhffsfssync_net_send_event(conn, vhffsfssync_net_parent_mtime(pathname) , VHFFSFSSYNC_NET_PRIO_MEDIUM);
@@ -536,9 +534,17 @@
void vhffsfssync_net_broadcast_file(char *pathname) {
GList *conns;
+
+ // if the file is being sent, cancel it
for(conns = g_list_first(vhffsfssync_conns) ; conns ; ) {
vhffsfssync_conn *conn = conns->data;
conns = g_list_next(conns);
+ vhffsfssync_net_remove_file(conn, pathname);
+ }
+
+ for(conns = g_list_first(vhffsfssync_conns) ; conns ; ) {
+ vhffsfssync_conn *conn = conns->data;
+ conns = g_list_next(conns);
vhffsfssync_net_send_file(conn, pathname);
}
}
@@ -841,6 +847,8 @@
if(! lstat(pathname, &st) ) {
if( S_ISREG(st.st_mode) ) {
+ // if the file is being sent, cancel it
+ vhffsfssync_net_remove_file(conn, pathname);
vhffsfssync_net_send_file(conn, pathname);
}
else if( S_ISDIR(st.st_mode) ) {