diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-08-23 15:51:37 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-08-23 15:52:42 +0200 |
commit | 25a628b3403249499ba3f87ab177c441c8f432ee (patch) | |
tree | 2c3df31ce3d0f4e45a404e6abdd714aa89b81751 /pfinet | |
parent | 7424060a895ea6beaaaa3cfcf090dd0438716aa9 (diff) |
Fix polling pfinet tun for write
* pfinet/tunnel.c (io_select_common): Also handle `SELECT_WRITE' case.
Diffstat (limited to 'pfinet')
-rw-r--r-- | pfinet/tunnel.c | 13 |
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) |