► |  | Web Server: HTTP Server

1 | Dispatching Server
2 | Dispatchers
3 | Launching Servers
4 | Web Servers
5 | Internal APIs
6 | Troubleshooting and Tips
| Index

▼ | 5 | Internal APIs

5.1 | Timers
5.2 | Connection Manager
5.3 | Serializable Closures
5.4 | Cache Table
5.5 | MIME Types
5.6 | Serialization Utilities
5.7 | URL Param
5.8 | GZip
5.9 | Miscellaneous Utilities

On this page:

connection
start-connection-manager
new-connection
kill-connection!
adjust-connection-timeout!

top ← prev up next →

#### 5.2`` Connection Manager

(require web-server/private/connection-manager)
| package: web-server-lib

This module provides functionality for managing pairs of input and output ports. We have plans to allow a number of different strategies for doing this.

> > struct
> > (struct |  | connection (timer i-port o-port custodian close?)
> > |  | #:extra-constructor-name make-connection)
> timer : timer?
> i-port : input-port?
> o-port : output-port?
> custodian : custodian?
> close? : boolean?

A connection is a pair of ports (i-port and o-port) that is ready to close after the current job if close? is #t. Resources associated with the connection should be allocated under custodian. The connection will last until timer triggers.

> procedure (start-connection-manager) → void

Runs the connection manager (now just the timer manager).

> > procedure
> > (new-connection |  | timeout |  |  |  |
> > |  | i-port |  |  |  |
> > |  | o-port |  |  |  |
> > |  | cust |  |  |  |
> > |  | close?) |  | → |  | connection?
> timeout : number?
> i-port : input-port?
> o-port : output-port?
> cust : custodian?
> close? : boolean?

Constructs a connection with a timer with a trigger of timeout that calls kill-connection!.

> procedure (kill-connection! c) → void
> c : connection?

Closes the ports associated with c, kills the timer, and shuts down the custodian.

> procedure (adjust-connection-timeout! c t) → void
> c : connection?
> t : number?

Calls increment-timer! with the timer behind c with t.
top ← prev up next →