diff options
author | Maria Matejka <mq@ucw.cz> | 2022-02-01 09:45:50 +0100 |
---|---|---|
committer | Maria Matejka <mq@ucw.cz> | 2022-02-03 10:30:33 +0100 |
commit | 8447b24e59bcb6bf1f5d0c2a00880b74bde748fd (patch) | |
tree | 853d6b6626356b512319055289cf0fba6417465b /lib | |
parent | 127862f626f39d52b758084931e0fbdc91db745c (diff) |
Socket cork fixes
Diffstat (limited to 'lib')
-rw-r--r-- | lib/event.c | 10 | ||||
-rw-r--r-- | lib/event.h | 2 | ||||
-rw-r--r-- | lib/io-loop.h | 1 | ||||
-rw-r--r-- | lib/socket.h | 1 |
4 files changed, 12 insertions, 2 deletions
diff --git a/lib/event.c b/lib/event.c index 766ffa15..10f83c28 100644 --- a/lib/event.c +++ b/lib/event.c @@ -283,7 +283,13 @@ void ev_uncork(struct event_cork *ec) birdloop_ping(el->loop); } - UNLOCK_DOMAIN(cork, ec->lock); + struct birdsock *sk; + WALK_LIST_FIRST2(sk, cork_node, ec->sockets) + { +// log(L_TRACE "Socket %p uncorked", sk); + rem_node(&sk->cork_node); + sk_ping(sk); + } - birdloop_ping(&main_birdloop); + UNLOCK_DOMAIN(cork, ec->lock); } diff --git a/lib/event.h b/lib/event.h index cd85bf78..3af33a7f 100644 --- a/lib/event.h +++ b/lib/event.h @@ -38,6 +38,7 @@ struct event_cork { DOMAIN(cork) lock; u32 count; list events; + list sockets; }; extern event_list global_event_list; @@ -56,6 +57,7 @@ static inline void ev_init_list(event_list *el, struct birdloop *loop, const cha static inline void ev_init_cork(struct event_cork *ec, const char *name) { init_list(&ec->events); + init_list(&ec->sockets); ec->lock = DOMAIN_NEW(cork, name); ec->count = 0; }; diff --git a/lib/io-loop.h b/lib/io-loop.h index 386a31d5..d60fb1ae 100644 --- a/lib/io-loop.h +++ b/lib/io-loop.h @@ -17,6 +17,7 @@ void sk_start(sock *s); void sk_stop(sock *s); void sk_reloop(sock *s, struct birdloop *loop); +void sk_ping(sock *s); extern struct birdloop main_birdloop; diff --git a/lib/socket.h b/lib/socket.h index 17d647f3..89398edf 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -59,6 +59,7 @@ typedef struct birdsock { uint rbsize; int (*rx_hook)(struct birdsock *, uint size); /* NULL=receiving turned off, returns 1 to clear rx buffer */ struct event_cork *cork; /* Cork to temporarily stop receiving data */ + node cork_node; /* Node in cork list */ byte *tbuf, *tpos; /* NULL=allocate automatically */ byte *ttx; /* Internal */ |