Browse Source

Protocol update

Stefan Bühler 11 years ago
  1. 30


@ -44,7 +44,7 @@
* Commands:
* - 0x0001: Bind a new backend
* Client -> Server (Request):
* Client -> Server (Request): bind_backend
* payload is the "name" string.
* request the socket address for a "new" backend; the name can
@ -52,21 +52,32 @@
* socket address (for example "unix:/var/run/fastcgi_php_www-default.sock")
* or a comma separated list of key=value pairs ("type=php5,user=www-default")
* Server -> Client (Response):
* Server -> Client (Response): return_backend
* payload is a 32-bit backend identifier, followed by the socket address (or an error message)
* A valid backend identifier mustn't be zero, and a valid backend must have a valid socket address.
* An error is signaled by a zero identifier, the following string contains an optional error message.
* The server may return the same id more than once for the same backend;
* the client must release each id as often as it got it in a bind request.
* The server should not return the same id more than once, not even for the same backend;
* but different ids can point to the same backend and address.
* (The reason here is that the server needs to sum up the update notifications.)
* The backend id should only be unique per connection; you can reuse the ids for a different
* connection.
* - 0x0002: Release backend
* Client -> Server (Notification):
* Client -> Server (Notification): release_backend
* payload is the 32-bit backend identifier
* A connection close is an implicit release of all remaining backends.
* Server -> Client (Notification): lost_backend
* payload ist the 32-bit backend identifier, followed by a string describing the reason
* I the client didn't already release the backend, it should send a release_backend
* notification to release the id.
* - 0x0003: Update backend
* Client -> Server (Notification):
* Client -> Server (Notification): update_backend
* payload are three unsigned 32-bit integers: backend identifier, "load" and "workers"
* "load" is the number of requests the client would like to process with the backend right now,
* and "workers" is the number of "workers" the client thinks the server should spawn.
@ -77,6 +88,13 @@
* The "workers" parameter may be useful in cases where you cascade different spawn-managers; the
* main spawn-manager may tell a sub spawn-manager how many children / threads it should use.
* - 0xffff: Unknown command
* Any direction; by default a notification, can be a response.
* payload is the 16-bit id of the unknown command.
* If you get such a message, you should check for the id of the command, and close the connection
* if the original message wasn't optional.