Index: libroar/vio.c
===================================================================
--- libroar/vio.c	(revision 5270)
+++ libroar/vio.c	(revision 5276)
@@ -65,5 +65,4 @@
  calls->write    = roar_vio_basic_write;
  calls->lseek    = roar_vio_basic_lseek;
- calls->nonblock = roar_vio_basic_nonblock;
  calls->sync     = roar_vio_basic_sync;
  calls->ctl      = roar_vio_basic_ctl;
@@ -179,6 +178,4 @@
 
 int     roar_vio_nonblock(struct roar_vio_calls * vio, int state) {
- int ret;
-
  ROAR_DBG("roar_vio_nonblock(vio=%p, state=%i) = ?", vio, state);
 
@@ -188,14 +185,5 @@
  }
 
- if ( vio->nonblock == NULL ) {
-  roar_err_set(ROAR_ERROR_NOSYS);
-  return -1;
- }
-
- roar_err_clear_all();
- ret = vio->nonblock(vio, state);
- roar_err_update();
-
- return ret;
+ return roar_vio_ctl(vio, ROAR_VIO_CTL_NONBLOCK, &state);
 }
 
@@ -346,5 +334,4 @@
  calls->read     = roar_vio_winsock_read;
  calls->write    = roar_vio_winsock_write;
- calls->nonblock = roar_vio_winsock_nonblock;
  calls->sync     = roar_vio_winsock_sync;
  calls->ctl      = roar_vio_winsock_ctl;
@@ -414,16 +401,4 @@
  return -1;
 #endif
-}
-
-int     roar_vio_basic_nonblock(struct roar_vio_calls * vio, int state) {
- if ( roar_socket_nonblock(roar_vio_get_fh(vio), state) == -1 )
-  return -1;
-
- if ( state == ROAR_SOCKET_NONBLOCK )
-  return 0;
-
- roar_vio_sync(vio);
-
- return 0;
 }
 
@@ -666,4 +641,14 @@
    break;
 #endif
+  case ROAR_VIO_CTL_NONBLOCK:
+    if ( roar_socket_nonblock(roar_vio_get_fh(vio), *(int*)data) == -1 )
+     return -1;
+
+    if ( *(int*)data == ROAR_SOCKET_NONBLOCK )
+     return 0;
+
+    roar_vio_sync(vio);
+    return 0;
+   break;
  }
 
@@ -713,5 +698,4 @@
  calls->write    = roar_vio_pass_write;
  calls->lseek    = roar_vio_pass_lseek;
- calls->nonblock = roar_vio_pass_nonblock;
  calls->sync     = roar_vio_pass_sync;
  calls->ctl      = roar_vio_pass_ctl;
@@ -733,8 +717,4 @@
 off_t   roar_vio_pass_lseek(struct roar_vio_calls * vio, off_t offset, int whence) {
  return roar_vio_lseek((struct roar_vio_calls *) vio->inst, offset, whence);
-}
-
-int     roar_vio_pass_nonblock(struct roar_vio_calls * vio, int state) {
- return roar_vio_nonblock((struct roar_vio_calls *) vio->inst, state);
 }
 
Index: libroar/vio_buffer.c
===================================================================
--- libroar/vio_buffer.c	(revision 4708)
+++ libroar/vio_buffer.c	(revision 5276)
@@ -63,5 +63,4 @@
  calls->close    = roar_vio_buffer_close;
  calls->write    = roar_vio_buffer_write;
- calls->nonblock = roar_vio_buffer_nonblock;
  calls->ctl      = roar_vio_buffer_ctl;
  calls->sync     = roar_vio_buffer_sync;
@@ -327,4 +326,11 @@
     return 0;
    break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    if ( self->use_re ) {
+     return roar_vio_ctl(&(self->re_vio), ROAR_VIO_CTL_NONBLOCK, data);
+    } else {
+     return roar_vio_ctl(self->backend, ROAR_VIO_CTL_NONBLOCK, data);
+    }
+   break;
  }
 
@@ -342,13 +348,3 @@
 }
 
-int     roar_vio_buffer_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_buffer * self = vio->inst;
-
- if ( self->use_re ) {
-  return roar_vio_nonblock(&(self->re_vio), state);
- } else {
-  return roar_vio_nonblock(self->backend, state);
- }
-}
-
 //ll
Index: libroar/vio_buffer_store.c
===================================================================
--- libroar/vio_buffer_store.c	(revision 4708)
+++ libroar/vio_buffer_store.c	(revision 5276)
@@ -56,5 +56,4 @@
  calls->inst     = self;
  calls->close    = roar_vio_buffer_store_close;
- calls->nonblock = roar_vio_buffer_store_nonblock;
  calls->sync     = roar_vio_buffer_store_sync;
  calls->ctl      = roar_vio_buffer_store_ctl;
@@ -138,8 +137,4 @@
 }
 
-int     roar_vio_buffer_store_nonblock(struct roar_vio_calls * vio, int state) {
- return 0; // if we are in nonblock or not is the same for us.
-}
-
 int     roar_vio_buffer_store_sync    (struct roar_vio_calls * vio) {
  return 0; // we are always sync.
@@ -160,4 +155,7 @@
     return 0;
    break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    return 0; // if we are in nonblock or not is the same for us.
+   break;
  }
 
Index: libroar/vio_cmd.c
===================================================================
--- libroar/vio_cmd.c	(revision 5111)
+++ libroar/vio_cmd.c	(revision 5276)
@@ -80,5 +80,4 @@
  calls->read     = roar_vio_cmd_read;
  calls->write    = roar_vio_cmd_write;
- calls->nonblock = roar_vio_cmd_nonblock;
  calls->sync     = roar_vio_cmd_sync;
  calls->ctl      = roar_vio_cmd_ctl;
@@ -514,19 +513,7 @@
 }
 
-int     roar_vio_cmd_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_cmd_state * self = (struct roar_vio_cmd_state *)vio->inst;
-
- self->options |= ROAR_VIO_CMD_OPTS_NONBLOCK;
-
- if ( state == ROAR_SOCKET_BLOCK )
-  self->options -= ROAR_VIO_CMD_OPTS_NONBLOCK;
-
- _LIBROAR_IGNORE_RET(roar_vio_nonblock(self->next, state)); // this should help, but may not nessessery.
-
- return 0;
-}
-
 int     roar_vio_cmd_sync    (struct roar_vio_calls * vio) {
  struct roar_vio_cmd_state * state = (struct roar_vio_cmd_state *)vio->inst;
+ int newblock = ROAR_SOCKET_BLOCK;
  int oldblock;
  int ret = 0;
@@ -534,5 +521,5 @@
  oldblock = state->options & ROAR_VIO_CMD_OPTS_NONBLOCK ? ROAR_SOCKET_NONBLOCK : ROAR_SOCKET_BLOCK;
 
- if ( roar_vio_cmd_nonblock(vio, ROAR_SOCKET_BLOCK) == -1 )
+ if ( roar_vio_cmd_ctl(vio, ROAR_VIO_CTL_NONBLOCK, &newblock) == -1 )
   return -1;
 
@@ -543,5 +530,5 @@
   ret = -1;
 
- if ( roar_vio_cmd_nonblock(vio, oldblock) == -1 )
+ if ( roar_vio_cmd_ctl(vio, ROAR_VIO_CTL_NONBLOCK, &oldblock) == -1 )
   return -1;
 
@@ -586,4 +573,12 @@
     return -1;
    break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    state->options |= ROAR_VIO_CMD_OPTS_NONBLOCK;
+
+    if ( *(int*)data == ROAR_SOCKET_BLOCK )
+     state->options -= ROAR_VIO_CMD_OPTS_NONBLOCK;
+
+    _LIBROAR_IGNORE_RET(roar_vio_ctl(state->next, cmd, data)); // this should help, but may not necessarily.
+   break;
   default:
     return -1;
Index: libroar/vio_jumbo.c
===================================================================
--- libroar/vio_jumbo.c	(revision 5270)
+++ libroar/vio_jumbo.c	(revision 5276)
@@ -58,5 +58,4 @@
  calls->write    = roar_vio_jumbo_write;
  calls->lseek    = roar_vio_jumbo_lseek;
- calls->nonblock = roar_vio_jumbo_nonblock;
  calls->sync     = roar_vio_jumbo_sync;
  calls->ctl      = roar_vio_jumbo_ctl;
@@ -130,10 +129,4 @@
 }
 
-int     roar_vio_jumbo_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_jumbo * self = vio->inst;
-
- return roar_vio_nonblock(self->backend, state);
-}
-
 int     roar_vio_jumbo_sync    (struct roar_vio_calls * vio) {
  struct roar_vio_jumbo * self = vio->inst;
@@ -156,4 +149,13 @@
 
 int     roar_vio_jumbo_ctl     (struct roar_vio_calls * vio, int cmd, void * data) {
+ struct roar_vio_jumbo * self = vio->inst;
+
+ switch (cmd) {
+  case ROAR_VIO_CTL_NONBLOCK:
+    return roar_vio_ctl(self->backend, cmd, data);
+   break;
+ }
+
+ roar_err_set(ROAR_ERROR_BADRQC);
  return -1;
 }
Index: libroar/vio_misc.c
===================================================================
--- libroar/vio_misc.c	(revision 5270)
+++ libroar/vio_misc.c	(revision 5276)
@@ -59,16 +59,4 @@
 }
 
-static int     roar_vio_misc_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_misc * self = vio->inst;
-
- if ( self->support_nonblocking )
-  return 0;
-
- if ( state == ROAR_SOCKET_BLOCK )
-  return 0;
-
- return -1;
-}
-
 static int     roar_vio_misc_sync    (struct roar_vio_calls * vio) {
  (void)vio;
@@ -94,4 +82,13 @@
     return 0;
    break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    if ( self->support_nonblocking )
+     return 0;
+
+    if ( *(int*)data == ROAR_SOCKET_BLOCK )
+     return 0;
+
+    return -1;
+   break; 
  }
 
@@ -112,5 +109,4 @@
  calls->write    = roar_vio_misc_write;
  calls->lseek    = roar_vio_misc_lseek;
- calls->nonblock = roar_vio_misc_nonblock;
  calls->sync     = roar_vio_misc_sync;
  calls->ctl      = roar_vio_misc_ctl;
Index: libroar/vio_pipe.c
===================================================================
--- libroar/vio_pipe.c	(revision 5270)
+++ libroar/vio_pipe.c	(revision 5276)
@@ -119,4 +119,6 @@
 #ifndef ROAR_WITHOUT_VIO_PIPE
 int roar_vio_pipe_init (struct roar_vio_calls * s,  struct roar_vio_pipe * self, int flags) {
+ int nonblock = ROAR_SOCKET_NONBLOCK;
+
  if ( s == NULL || self == NULL )
   return -1;
@@ -127,5 +129,4 @@
  s->read     = roar_vio_pipe_read;
  s->write    = roar_vio_pipe_write;
- s->nonblock = roar_vio_pipe_nonblock;
  s->sync     = roar_vio_pipe_sync;
 
@@ -133,5 +134,5 @@
 
  if ( flags & O_NONBLOCK ) {
-  roar_vio_pipe_nonblock(s, ROAR_SOCKET_NONBLOCK);
+  roar_vio_pipe_ctl(s, ROAR_VIO_CTL_NONBLOCK, &nonblock);
  }
 
@@ -187,29 +188,4 @@
 }
 
-int     roar_vio_pipe_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_pipe * self;
-
- if ( vio == NULL )
-  return -1;
-
- if ( (self = (struct roar_vio_pipe *)vio->inst) == NULL )
-  return -1;
-
- switch (self->type) {
-  case ROAR_VIO_PIPE_TYPE_PIPE:
-    if ( roar_socket_nonblock(self->b.p[ROAR_VIO_PIPE_S(self,vio)*2], state) == -1 )
-     return -1;
-    return roar_socket_nonblock(self->b.p[(ROAR_VIO_PIPE_SR(self,vio)*2)+1], state);
-   break;
-#ifdef ROAR_HAVE_UNIX
-  case ROAR_VIO_PIPE_TYPE_SOCKET:
-    return roar_socket_nonblock(self->b.p[ROAR_VIO_PIPE_S(self,vio)], state);
-   break;
-#endif
- }
-
- return -1;
-}
-
 int     roar_vio_pipe_sync    (struct roar_vio_calls * vio) {
  // we may add fdatasync() calls here depending on the type
@@ -276,4 +252,18 @@
        return 0;
       break;
+    }
+   break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    switch (self->type) {
+     case ROAR_VIO_PIPE_TYPE_PIPE:
+       if ( roar_socket_nonblock(self->b.p[ROAR_VIO_PIPE_S(self,vio)*2], *(int*)data) == -1 )
+        return -1;
+       return roar_socket_nonblock(self->b.p[(ROAR_VIO_PIPE_SR(self,vio)*2)+1], *(int*)data);
+      break;
+#ifdef ROAR_HAVE_UNIX
+     case ROAR_VIO_PIPE_TYPE_SOCKET:
+       return roar_socket_nonblock(self->b.p[ROAR_VIO_PIPE_S(self,vio)], *(int*)data);
+      break;
+#endif
     }
    break;
Index: libroar/vio_proto.c
===================================================================
--- libroar/vio_proto.c	(revision 5254)
+++ libroar/vio_proto.c	(revision 5276)
@@ -121,5 +121,4 @@
  calls->write    = roar_vio_proto_write;
 // calls->lseek    = roar_vio_proto_lseek; // TODO: this is currently not supported
- calls->nonblock = roar_vio_proto_nonblock;
  calls->sync     = roar_vio_proto_sync;
  calls->ctl      = roar_vio_proto_ctl;
@@ -232,13 +231,4 @@
 // TODO: this is currently not implemented as this is hard to implement with buffers:
 off_t   roar_vio_proto_lseek   (struct roar_vio_calls * vio, off_t offset, int whence);
-
-int     roar_vio_proto_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_proto * self = vio->inst;
-
- /* we can simply use the next layer's nonblock as all we do in addtion *
-  * to call there functions are our buffers which do not block normaly  */
-
- return roar_vio_nonblock(self->next, state);
-}
 
 int     roar_vio_proto_sync    (struct roar_vio_calls * vio) {
Index: libroar/vio_rtp.c
===================================================================
--- libroar/vio_rtp.c	(revision 5111)
+++ libroar/vio_rtp.c	(revision 5276)
@@ -115,5 +115,4 @@
  calls->write              = roar_vio_rtp_write;
 // calls->lseek              = roar_vio_rtp_lseek;
- calls->nonblock           = roar_vio_rtp_nonblock;
  calls->sync               = roar_vio_rtp_sync;
  calls->ctl                = roar_vio_rtp_ctl;
@@ -316,12 +315,4 @@
 off_t   roar_vio_rtp_lseek   (struct roar_vio_calls * vio, off_t offset, int whence);
 
-int     roar_vio_rtp_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_rtp_inst * self = vio->inst;
-
- ROAR_DBG("roar_vio_rtp_nonblock(vio=%p, state=%i) = ?", vio, state);
-
- return roar_vio_nonblock(self->vio, state);
-}
-
 int     roar_vio_rtp_sync    (struct roar_vio_calls * vio) {
  struct roar_rtp_inst * self = vio->inst;
Index: libroar/vio_stack.c
===================================================================
--- libroar/vio_stack.c	(revision 4975)
+++ libroar/vio_stack.c	(revision 5276)
@@ -65,5 +65,4 @@
  calls->write    = roar_vio_stack_write;
  calls->lseek    = roar_vio_stack_lseek;
- calls->nonblock = roar_vio_stack_nonblock;
  calls->sync     = roar_vio_stack_sync;
 
@@ -184,17 +183,4 @@
 }
 
-int     roar_vio_stack_nonblock(struct roar_vio_calls * vio, int state) {
- if ( vio == NULL )
-  return -1;
-
- if ( vio->inst == NULL )
-  return -1;
-
- if ( ((struct roar_vio_stack*)(vio->inst))->cur == NULL )
-  return -1;
-
- return roar_vio_nonblock(((struct roar_vio_stack*)(vio->inst))->cur, state);
-}
-
 int     roar_vio_stack_sync    (struct roar_vio_calls * vio) {
  if ( vio == NULL )
Index: libroar/vio_stdvios.c
===================================================================
--- libroar/vio_stdvios.c	(revision 4708)
+++ libroar/vio_stdvios.c	(revision 5276)
@@ -43,5 +43,4 @@
    .write    = roar_vio_basic_write,
    .lseek    = roar_vio_basic_lseek,
-   .nonblock = roar_vio_basic_nonblock,
    .sync     = roar_vio_basic_sync,
    .ctl      = roar_vio_basic_ctl,
@@ -54,5 +53,4 @@
    .write    = roar_vio_basic_write,
    .lseek    = roar_vio_basic_lseek,
-   .nonblock = roar_vio_basic_nonblock,
    .sync     = roar_vio_basic_sync,
    .ctl      = roar_vio_basic_ctl,
@@ -65,5 +63,4 @@
    .write    = roar_vio_basic_write,
    .lseek    = roar_vio_basic_lseek,
-   .nonblock = roar_vio_basic_nonblock,
    .sync     = roar_vio_basic_sync,
    .ctl      = roar_vio_basic_ctl,
Index: libroar/vio_stream.c
===================================================================
--- libroar/vio_stream.c	(revision 5238)
+++ libroar/vio_stream.c	(revision 5276)
@@ -47,7 +47,4 @@
  return roar_vio_lseek(roar_get_connection_vio2(vio->inst), offset, whence);
 }
-static int     _vio_stream_nonblock(struct roar_vio_calls * vio, int state) {
- return roar_vio_nonblock(roar_get_connection_vio2(vio->inst), state);
-}
 static int     _vio_stream_sync    (struct roar_vio_calls * vio) {
  return roar_vio_sync(roar_get_connection_vio2(vio->inst));
@@ -81,4 +78,7 @@
     roar_err_set(ROAR_ERROR_NOTSUP);
     return -1;
+   break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    return roar_vio_ctl(roar_get_connection_vio2(vio->inst), ROAR_VIO_CTL_NONBLOCK, data);
    break;
  }
@@ -143,5 +143,4 @@
  calls->write      = _vio_stream_write;
  calls->lseek      = _vio_stream_lseek;
- calls->nonblock   = _vio_stream_nonblock;
  calls->sync       = _vio_stream_sync;
  calls->ctl        = _vio_stream_ctl;
Index: libroar/vio_winsock.c
===================================================================
--- libroar/vio_winsock.c	(revision 4708)
+++ libroar/vio_winsock.c	(revision 5276)
@@ -45,7 +45,4 @@
 }
 
-int     roar_vio_winsock_nonblock(struct roar_vio_calls * vio, int state) {
- return -1;
-}
 int     roar_vio_winsock_sync    (struct roar_vio_calls * vio) {
  return 0;
@@ -123,4 +120,5 @@
  }
 
+ roar_err_set(ROAR_ERROR_BADRQC);
  return -1;
 }
Index: libroar/vio_zlib.c
===================================================================
--- libroar/vio_zlib.c	(revision 5270)
+++ libroar/vio_zlib.c	(revision 5276)
@@ -435,9 +435,4 @@
 }
 
-static int     roar_vio_zlib_nonblock(struct roar_vio_calls * vio, int state) {
- struct roar_vio_gzip * self = vio->inst;
- return roar_vio_nonblock(self->next, state);
-}
-
 static int     roar_vio_zlib_sync    (struct roar_vio_calls * vio) {
  struct roar_vio_gzip * self = vio->inst;
@@ -483,4 +478,7 @@
     return -1;
    break;
+  case ROAR_VIO_CTL_NONBLOCK:
+    return roar_vio_ctl(self->next, cmd, data);
+   break;
   default:
     roar_err_set(ROAR_ERROR_BADRQC);
@@ -545,5 +543,4 @@
  calls->write      = roar_vio_zlib_write;
  calls->lseek      = roar_vio_zlib_lseek;
- calls->nonblock   = roar_vio_zlib_nonblock;
  calls->sync       = roar_vio_zlib_sync;
  calls->ctl        = roar_vio_zlib_ctl;
