- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 as published
- * by the Free Software Foundation.
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
*/
* Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
*/
arglist_start(argp, fmt);
g_vsnprintf(msg, sizeof(msg), fmt, argp);
arglist_end(argp);
arglist_start(argp, fmt);
g_vsnprintf(msg, sizeof(msg), fmt, argp);
arglist_end(argp);
XferElement *elt = (XferElement *)data;
XferDestTaperDirectTCP *self = (XferDestTaperDirectTCP *)data;
GTimer *timer = g_timer_new();
XferElement *elt = (XferElement *)data;
XferDestTaperDirectTCP *self = (XferDestTaperDirectTCP *)data;
GTimer *timer = g_timer_new();
/* This thread's job is to accept() an incoming connection, then call
* write_from_connection for each part, and then close the connection */
/* This thread's job is to accept() an incoming connection, then call
* write_from_connection for each part, and then close the connection */
/* first, accept a new connection from the device */
DBG(2, "accepting DirectTCP connection on device %s", self->device->device_name);
/* first, accept a new connection from the device */
DBG(2, "accepting DirectTCP connection on device %s", self->device->device_name);
- if (!device_accept(self->device, &self->conn, NULL, NULL)) {
+ result = device_accept(self->device, &self->conn, &elt->cancelled,
+ self->state_mutex, self->abort_cond);
+ if (result == 1 && !elt->cancelled) {
xfer_cancel_with_error(XFER_ELEMENT(self),
"accepting DirectTCP connection: %s",
device_error_or_status(self->device));
g_mutex_unlock(self->state_mutex);
xfer_cancel_with_error(XFER_ELEMENT(self),
"accepting DirectTCP connection: %s",
device_error_or_status(self->device));
g_mutex_unlock(self->state_mutex);
}
DBG(2, "connection accepted; sending XMSG_READY");
xfer_queue_message(elt->xfer, xmsg_new(elt, XMSG_READY, 0));
}
DBG(2, "connection accepted; sending XMSG_READY");
xfer_queue_message(elt->xfer, xmsg_new(elt, XMSG_READY, 0));
- if (!device_write_from_connection(self->device,
- self->part_size, &size)) {
+ result = device_write_from_connection(self->device,
+ self->part_size, &size, &elt->cancelled,
+ self->state_mutex, self->abort_cond);
+ if (result == 1 && !elt->cancelled) {
/* even if this is just a physical EOM, we may have lost data, so
* the whole transfer is dead. */
xfer_cancel_with_error(XFER_ELEMENT(self),
"Error writing from DirectTCP connection: %s",
device_error_or_status(self->device));
goto cancelled;
/* even if this is just a physical EOM, we may have lost data, so
* the whole transfer is dead. */
xfer_cancel_with_error(XFER_ELEMENT(self),
"Error writing from DirectTCP connection: %s",
device_error_or_status(self->device));
goto cancelled;
-static void
-cache_inform_impl(
- XferDestTaper *xdtself G_GNUC_UNUSED,
- const char *filename G_GNUC_UNUSED,
- off_t offset G_GNUC_UNUSED,
- off_t length G_GNUC_UNUSED)
-{
- /* do nothing */
-}
-
klass->cancel = cancel_impl;
xdt_klass->start_part = start_part_impl;
xdt_klass->use_device = use_device_impl;
klass->cancel = cancel_impl;
xdt_klass->start_part = start_part_impl;
xdt_klass->use_device = use_device_impl;