iPXE
Functions
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. More...
 
void pool_reopen (struct interface *intf)
 Reopen a defunct connection. More...
 
void pool_add (struct pooled_connection *pool, struct list_head *list, unsigned long expiry)
 Add connection to pool. More...
 
void pool_del (struct pooled_connection *pool)
 Remove connection from pool. More...
 
void pool_expired (struct retry_timer *timer, int over __unused)
 Close expired pooled connection. More...
 

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 pool_recycle(struct interface *intf)
Recycle this connection after closing.
Definition: pool.c:42
void intf_poke(struct interface *intf, void(type)(struct interface *intf))
Poke an object interface.
Definition: interface.c:421

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
void intf_poke(struct interface *intf, void(type)(struct interface *intf))
Poke an object interface.
Definition: interface.c:421

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 }
timer_init & pool
Definition: pool.h:66
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
Definition: list.h:94
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 }
timer_init & pool
Definition: pool.h:66
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
Connection has been recycled.
Definition: pool.h:43
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46
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 }
timer_init & pool
Definition: pool.h:66
A pooled connection.
Definition: pool.h:18
A timer.
Definition: timer.h:29
#define list_empty(list)
Test whether a list is empty.
Definition: list.h:137
#define list_del(list)
Delete an entry from a list.
Definition: list.h:120
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
#define container_of(ptr, type, field)
Get containing structure.
Definition: stddef.h:36
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:46

References assert(), container_of, INIT_LIST_HEAD, list_del, list_empty, and pool.