iPXE
pool.c File Reference

Pooled connections. More...

#include <assert.h>
#include <ipxe/pool.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
void pool_recycle (struct interface *intf)
 Recycle this connection after closing.
void pool_reopen (struct interface *intf)
 Reopen a defunct connection.
void pool_add (struct pooled_connection *pool, struct list_head *list, unsigned long expiry)
 Add connection to pool.
void pool_del (struct pooled_connection *pool)
 Remove connection from pool.
void pool_expired (struct retry_timer *timer, int over __unused)
 Close expired pooled connection.

Detailed Description

Pooled connections.

Definition in file pool.c.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ pool_recycle()

void pool_recycle ( struct interface * intf)

Recycle this connection after closing.

Parameters
intfData transfer interface

Definition at line 42 of file pool.c.

42 {
43
44 intf_poke ( intf, pool_recycle );
45}
void intf_poke(struct interface *intf, void(type)(struct interface *intf))
Poke an object interface.
Definition interface.c:421
void pool_recycle(struct interface *intf)
Recycle this connection after closing.
Definition pool.c:42

References intf_poke(), and pool_recycle().

Referenced by http_transfer_complete(), and pool_recycle().

◆ pool_reopen()

void pool_reopen ( struct interface * intf)

Reopen a defunct connection.

Parameters
intfData transfer interface

Definition at line 52 of file pool.c.

52 {
53
54 intf_poke ( intf, pool_reopen );
55}
void pool_reopen(struct interface *intf)
Reopen a defunct connection.
Definition pool.c:52

References intf_poke(), and pool_reopen().

Referenced by http_conn_socket_close(), and pool_reopen().

◆ pool_add()

void pool_add ( struct pooled_connection * pool,
struct list_head * list,
unsigned long expiry )

Add connection to pool.

Parameters
poolPooled connection
listList of pooled connections
expiryExpiry time

Definition at line 64 of file pool.c.

65 {
66
67 /* Sanity check */
68 assert ( list_empty ( &pool->list ) );
69 assert ( ! timer_running ( &pool->timer ) );
70
71 /* Add to list of pooled connections */
72 list_add_tail ( &pool->list, list );
73
74 /* Start expiry timer */
75 start_timer_fixed ( &pool->timer, expiry );
76}
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition list.h:94
#define list_empty(list)
Test whether a list is empty.
Definition list.h:137
timer_init & pool
Definition pool.h:66
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
Definition retry.c:65

References assert, list_add_tail, list_empty, pool, and start_timer_fixed().

Referenced by http_conn_xfer_close().

◆ pool_del()

void pool_del ( struct pooled_connection * pool)

Remove connection from pool.

Parameters
poolPooled connection

Definition at line 83 of file pool.c.

83 {
84
85 /* Remove from list of pooled connections */
86 list_del ( &pool->list );
87 INIT_LIST_HEAD ( &pool->list );
88
89 /* Stop expiry timer */
90 stop_timer ( &pool->timer );
91
92 /* Mark as a freshly recycled connection */
93 pool->flags = POOL_RECYCLED;
94}
#define list_del(list)
Delete an entry from a list.
Definition list.h:120
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition list.h:46
@ POOL_RECYCLED
Connection has been recycled.
Definition pool.h:43
void stop_timer(struct retry_timer *timer)
Stop timer.
Definition retry.c:118

References INIT_LIST_HEAD, list_del, pool, POOL_RECYCLED, and stop_timer().

Referenced by http_conn_close(), and http_connect().

◆ pool_expired()

void pool_expired ( struct retry_timer * timer,
int over __unused )

Close expired pooled connection.

Parameters
timerExpiry timer
overFailure indicator

Definition at line 102 of file pool.c.

102 {
103 struct pooled_connection *pool =
105
106 /* Sanity check */
107 assert ( ! list_empty ( &pool->list ) );
108
109 /* Remove from connection pool */
110 list_del ( &pool->list );
111 INIT_LIST_HEAD ( &pool->list );
112
113 /* Close expired connection */
114 pool->expired ( pool );
115}
#define container_of(ptr, type, field)
Get containing structure.
Definition stddef.h:36
A pooled connection.
Definition pool.h:18
A timer.
Definition timer.h:29

References __unused, assert, container_of, INIT_LIST_HEAD, list_del, list_empty, and pool.