summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index f13c8423..22e77169 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -130,17 +130,14 @@ void ap_fini(void)
free(_ap_instance);
}
-#if 0
static int port_id_to_fd(int port_id)
{
int i;
for (i = 0; i < AP_MAX_FLOWS; ++i)
- if (_ap_instance->flows[i].port_id == port_id
- && _ap_instance->flows[i].state != FLOW_NULL)
+ if (_ap_instance->flows[i].port_id == port_id)
return i;
return -1;
}
-#endif
int flow_accept(char ** ae_name)
{
@@ -523,6 +520,14 @@ ssize_t flow_write(int fd, void * buf, size_t count)
return 0;
}
+int flow_select(const struct timespec * timeout)
+{
+ int port_id = shm_ap_rbuff_peek(_ap_instance->rb, timeout);
+ if (port_id < 0)
+ return port_id;
+ return port_id_to_fd(port_id);
+}
+
ssize_t flow_read(int fd, void * buf, size_t count)
{
int idx = -1;