summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pfinet/tunnel.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/pfinet/tunnel.c b/pfinet/tunnel.c
index 4a6f616a..495356c2 100644
--- a/pfinet/tunnel.c
+++ b/pfinet/tunnel.c
@@ -479,14 +479,23 @@ io_select_common (struct trivfs_protid *cred,
tdev = (struct tunnel_device *) cred->po->cntl->hook;
- /* We only deal with SELECT_READ here. */
- *type &= SELECT_READ;
+ /* We only deal with SELECT_READ and SELECT_WRITE here. */
+ *type &= SELECT_READ | SELECT_WRITE;
if (*type == 0)
return 0;
pthread_mutex_lock (&tdev->lock);
+ if (*type & SELECT_WRITE)
+ {
+ /* We are always writable. */
+ if (skb_queue_len (&tdev->xq) == 0)
+ *type &= ~SELECT_READ;
+ pthread_mutex_unlock (&tdev->lock);
+ return 0;
+ }
+
while (1)
{
if (skb_queue_len (&tdev->xq) != 0)