--- a/src/transport.c Tue Apr 28 23:09:28 2009 +0300
+++ b/src/transport.c Tue Apr 28 23:10:30 2009 +0300
@@ -19,9 +19,19 @@
void* transport_check (transport_t *transport, const struct transport_type *type)
{
+ const struct transport_type *tp_type;
+
// sanity check
- assert(type && transport->type == type);
+ assert(type);
+ // look for a matching type in the transport's type list
+ for (tp_type = transport->type; tp_type; tp_type = tp_type->parent)
+ if (tp_type == type)
+ break;
+
+ // make sure we found one
+ assert(tp_type);
+
// ok
return transport;
}
@@ -74,7 +84,7 @@
{
// not readable
if (!transport->type->methods.read)
- return -1;
+ return SET_ERROR(err, -1);
// proxy off to method handler
if (transport->type->methods.read(transport, buf, &len, err))
@@ -88,7 +98,7 @@
{
// XXX: not writeable
if (!transport->type->methods.write)
- return -1;
+ return SET_ERROR(err, -1);
// proxy off to method handler
if (transport->type->methods.write(transport, buf, &len, err))