View | Details | Raw Unified
Collapse All | Expand All

(-) gamin-0.0.26.orig/libgamin/gam_api.c (-11 lines)
 Lines 1300-1306    Link Here 
int
int
FAMCancelMonitor(FAMConnection * fc, const FAMRequest * fr)
FAMCancelMonitor(FAMConnection * fc, const FAMRequest * fr)
{
{
    GAMDataPtr conn;
    int ret;
    int ret;
    if ((fc == NULL) || (fr == NULL)) {
    if ((fc == NULL) || (fr == NULL)) {
 Lines 1317-1332    Link Here 
    GAM_DEBUG(DEBUG_INFO, "FAMCancelMonitor(%d)\n", fr->reqnum);
    GAM_DEBUG(DEBUG_INFO, "FAMCancelMonitor(%d)\n", fr->reqnum);
    /*
    /*
     * destroy the request internally
     */
    conn = fc->client;
    ret = gamin_data_del_req(conn, fr->reqnum);
    if (ret < 0) {
        FAMErrno = FAM_ARG;
        return (-1);
    }
    /*
     * send destruction message to the server
     * send destruction message to the server
     */
     */
    ret = gamin_send_request(GAM_REQ_CANCEL, fc->fd, NULL,
    ret = gamin_send_request(GAM_REQ_CANCEL, fc->fd, NULL,
(-) gamin-0.0.26.orig/libgamin/gam_data.c (+6 lines)
 Lines 458-463    Link Here 
    event->code = evn->type;
    event->code = evn->type;
    conn->evn_ready = 0;
    conn->evn_ready = 0;
    conn->evn_read -= evn->len;
    conn->evn_read -= evn->len;
    if (event->code == FAMAcknowledge) {
        /*
         * destroy the request internally
         */
        gamin_data_del_req(conn, evn->seq);
    }
    if (conn->evn_read > 0) {
    if (conn->evn_read > 0) {
        /*
        /*
         * there was other events piggy-backed on the same read,
         * there was other events piggy-backed on the same read,
(-) gamin-0.0.26.orig/server/gam_connection.c (-2 / +65 lines)
 Lines 327-333    Link Here 
            gam_subscription_set_listener(sub, conn->listener);
            gam_subscription_set_listener(sub, conn->listener);
            gam_add_subscription(sub);
            gam_add_subscription(sub);
            break;
            break;
        case GAM_REQ_CANCEL:
        case GAM_REQ_CANCEL: {
            char *path;
            int pathlen;
            sub =
            sub =
                gam_listener_get_subscription_by_reqno(conn->listener,
                gam_listener_get_subscription_by_reqno(conn->listener,
                                            	       req->seq);
                                            	       req->seq);
 Lines 339-347    Link Here 
            }
            }
            GAM_DEBUG(DEBUG_INFO, "Cancelling subscription for (%d)\n",
            GAM_DEBUG(DEBUG_INFO, "Cancelling subscription for (%d)\n",
                      req->seq);
                      req->seq);
            path = g_strdup(gam_subscription_get_path(sub));
            pathlen = gam_subscription_pathlen(sub);
            gam_remove_subscription(sub);
            gam_remove_subscription(sub);
            gam_listener_remove_subscription(conn->listener, sub);
            gam_listener_remove_subscription(conn->listener, sub);
            break;
            if (gam_send_ack(conn, req->seq, path, pathlen) < 0) {
                GAM_DEBUG(DEBUG_INFO, "Failed to send ack to PID %d\n",
                          gam_connection_get_pid(conn));
            }
            g_free(path);
        }   break;
        case GAM_REQ_DEBUG:
        case GAM_REQ_DEBUG:
#ifdef GAMIN_DEBUG_API
#ifdef GAMIN_DEBUG_API
	    gam_debug_add(conn, &req->path[0], options);
	    gam_debug_add(conn, &req->path[0], options);
 Lines 543-549    Link Here 
        return (-1);
        return (-1);
    }
    }
    return (0);
    return (0);
}
/**
 * gam_send_ack:
 * @conn: the connection data
 * @path: the file/directory path
 *
 * Emit an acknowledge event to the connection
 *
 * Returns 0 in case of success and -1 in case of failure
 */
int
gam_send_ack(GamConnDataPtr conn, int reqno,
             const char *path, int len)
{
    GAMPacket req;
    size_t tlen;
    int ret;
    if ((conn == NULL) || (conn->fd < 0) || (path == NULL))
        return (-1);
    if (len <= 0) {
        GAM_DEBUG(DEBUG_INFO, "Empty file path\n");
        return (-1);
    }
    if (len >= MAXPATHLEN) {
        GAM_DEBUG(DEBUG_INFO, "File path too long %s\n", path);
        return (-1);
    }
    GAM_DEBUG(DEBUG_INFO, "Event to %d : %d, %d, %s\n", conn->pid,
              reqno, FAMAcknowledge, path);
    /*
     * prepare the packet
     */
    tlen = GAM_PACKET_HEADER_LEN + len;
    /* We use only local socket so no need for network byte order conversion */
    req.len = (unsigned short) tlen;
    req.version = GAM_PROTO_VERSION;
    req.seq = reqno;
    req.type = FAMAcknowledge;
    req.pathlen = len;
    memcpy(&req.path[0], path, len);
    ret =
        gam_client_conn_write(conn->source, conn->fd, (gpointer) & req,
                              tlen);
    if (!ret) {
        GAM_DEBUG(DEBUG_INFO, "Failed to send event to %d\n", conn->pid);
        return (-1);
    }
    return (0);
}
}
/************************************************************************
/************************************************************************
(-) gamin-0.0.26.orig/server/gam_connection.h (+4 lines)
 Lines 47-52    Link Here 
					 int event,
					 int event,
					 const char *path,
					 const char *path,
					 int len);
					 int len);
int		gam_send_ack		(GamConnDataPtr conn,
					 int reqno,
					 const char *path,
					 int len);
void		gam_connections_debug	(void);
void		gam_connections_debug	(void);
#ifdef __cplusplus
#ifdef __cplusplus
}
}