diff options
-rw-r--r-- | sysdep/unix/wg_user.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sysdep/unix/wg_user.c b/sysdep/unix/wg_user.c index 34d456d5..6920d9ef 100644 --- a/sysdep/unix/wg_user.c +++ b/sysdep/unix/wg_user.c @@ -59,6 +59,24 @@ static void user_tx_hook(struct birdsock *bs) { DBG(L_TRACE "WG: TX %p %d", bs, bs->tpos - bs->ttx); + + uint size = (uintptr_t)bs->data; + + if (size > 0) + { + int res = sk_send(bs, bs->tbsize - size); + + /* Send data, <0=err, >0=ok, 0=sleep */ + log(L_TRACE "WG: send %d", res); + + if (res != 0) + { + //rfree(sock); + //shutdown(sock->fd, SHUT_WR); + } + + bs->data = NULL; + } } /* errno or zero if EOF */ @@ -258,9 +276,7 @@ wg_user_set_device(struct pool *pool, rfree(sock); return -1; } - res = sk_send(sock, tbsize - size); - /* Send data, <0=err, >0=ok, 0=sleep */ - DBG(L_TRACE "WG: send %d", res); + sock->data = (void*)(uintptr_t)size; /* abort(); */ return -1; |