diff --git a/obexd/src/mimetype.c b/obexd/src/mimetype.c
index 212f24b..cf6e15d 100644
--- a/obexd/src/mimetype.c
+++ b/obexd/src/mimetype.c
return NULL;
}
-static void reset_io_watch(void *object)
+void obex_object_reset_io_watch(void *object)
{
struct io_watch *watch;
g_free(watch);
}
-static int set_io_watch(void *object, obex_object_io_func func,
+int obex_object_set_io_watch(void *object, obex_object_io_func func,
void *user_data)
{
struct io_watch *watch;
- if (func == NULL) {
- reset_io_watch(object);
- return 0;
- }
-
watch = find_io_watch(object);
if (watch)
return -EPERM;
return -EPERM;
}
- if (driver->set_io_watch == NULL)
- driver->set_io_watch = set_io_watch;
-
DBG("driver %p mimetype %s registered", driver, driver->mimetype);
drivers = g_slist_append(drivers, driver);
diff --git a/obexd/src/mimetype.h b/obexd/src/mimetype.h
index e1c14f4..55ddded 100644
--- a/obexd/src/mimetype.h
+++ b/obexd/src/mimetype.h
int (*copy) (const char *name, const char *destname);
int (*move) (const char *name, const char *destname);
int (*remove) (const char *name);
- int (*set_io_watch) (void *object, obex_object_io_func func,
- void *user_data);
};
int obex_mime_type_driver_register(struct obex_mime_type_driver *driver);
unsigned int who_size);
void obex_object_set_io_flags(void *object, int flags, int err);
+
+void obex_object_reset_io_watch(void *object);
+int obex_object_set_io_watch(void *object, obex_object_io_func func,
+ void *user_data);
diff --git a/obexd/src/obex.c b/obexd/src/obex.c
index 3a68fd6..4bf5ad1 100644
--- a/obexd/src/obex.c
+++ b/obexd/src/obex.c
os_session_mark_aborted(os);
if (os->object) {
- os->driver->set_io_watch(os->object, NULL, NULL);
+ obex_object_reset_io_watch(os->object);
os->driver->close(os->object);
if (os->aborted && os->cmd == G_OBEX_OP_PUT && os->path &&
os->driver->remove)
if (len == -ENOSTR)
return 0;
if (len == -EAGAIN)
- os->driver->set_io_watch(os->object, handle_async_io,
+ obex_object_set_io_watch(os->object, handle_async_io,
os);
}
if (os->object && os->driver && os->driver->flush) {
if (os->driver->flush(os->object) == -EAGAIN) {
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io,
+ obex_object_set_io_watch(os->object, handle_async_io,
os);
return;
}
if (ret == -EAGAIN) {
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return TRUE;
}
return err;
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return 0;
}
break;
case -EAGAIN:
g_obex_suspend(os->obex);
- os->driver->set_io_watch(os->object, handle_async_io, os);
+ obex_object_set_io_watch(os->object, handle_async_io, os);
return TRUE;
default:
os_set_response(os, ret);