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)
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 ( GPL2_OR_LATER_OR_UBDL  )
void pool_recycle ( struct interface intf)

Recycle this connection after closing.

Parameters:
intfData transfer interface

Definition at line 41 of file pool.c.

References intf_poke().

Referenced by http_transfer_complete().

                                             {

        intf_poke ( intf, pool_recycle );
}
void pool_reopen ( struct interface intf)

Reopen a defunct connection.

Parameters:
intfData transfer interface

Definition at line 51 of file pool.c.

References intf_poke(), and pool_reopen().

Referenced by http_conn_socket_close(), and pool_reopen().

                                            {

        intf_poke ( intf, pool_reopen );
}
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 63 of file pool.c.

References assert, pooled_connection::list, list_add_tail, list_empty, start_timer_fixed(), and pooled_connection::timer.

Referenced by http_conn_xfer_close().

                                       {

        /* Sanity check */
        assert ( list_empty ( &pool->list ) );
        assert ( ! timer_running ( &pool->timer ) );

        /* Add to list of pooled connections */
        list_add_tail ( &pool->list, list );

        /* Start expiry timer */
        start_timer_fixed ( &pool->timer, expiry );
}
void pool_del ( struct pooled_connection pool)

Remove connection from pool.

Parameters:
poolPooled connection

Definition at line 82 of file pool.c.

References pooled_connection::flags, INIT_LIST_HEAD, pooled_connection::list, list_del, POOL_RECYCLED, stop_timer(), and pooled_connection::timer.

Referenced by http_conn_close(), and http_connect().

                                                 {

        /* Remove from list of pooled connections */
        list_del ( &pool->list );
        INIT_LIST_HEAD ( &pool->list );

        /* Stop expiry timer */
        stop_timer ( &pool->timer );

        /* Mark as a freshly recycled connection */
        pool->flags = POOL_RECYCLED;
}
void pool_expired ( struct retry_timer timer,
int over  __unused 
)

Close expired pooled connection.

Parameters:
timerExpiry timer
overFailure indicator

Definition at line 101 of file pool.c.

References assert, container_of, pooled_connection::expired, INIT_LIST_HEAD, pooled_connection::list, list_del, and list_empty.

                                                                   {
        struct pooled_connection *pool =
                container_of ( timer, struct pooled_connection, timer );

        /* Sanity check */
        assert ( ! list_empty ( &pool->list ) );

        /* Remove from connection pool */
        list_del ( &pool->list );
        INIT_LIST_HEAD ( &pool->list );

        /* Close expired connection */
        pool->expired ( pool );
}