blackhole.connection

Provide mechanisms for processing socket data.

This module provides methods for Blackhole to use internally for binding and listening on sockets as well as process all incoming socket data and responding appropriately.

blackhole.connection

blackhole.connection.sockets()[source]

Spawn a looper which loops over socket data and creates the sockets.

It should only ever loop over a maximum of two - standard (std) and SSL (ssl).

This way we’re able to detect incoming connection vectors and handle them accordingly.

A dictionary of sockets is then returned to later be added to the IOLoop.

blackhole.connection.connection_stream(connection)[source]

Detect which socket the connection is being made on, create and iostream for the connection, wrapping it in SSL if connected over the SSL socket.

The parameter ‘connection’ is an instance of ‘socket’ from stdlib.

blackhole.connection.handle_command(line, mail_state)[source]

Handle each SMTP command as it’s sent to the server

The paramater ‘line’ is the currently stream of data ending in ‘n’. ‘mail_state’ is an instance of ‘blackhole.state.MailState’.

blackhole.connection.connection_ready(sock, fd, events)[source]

Accepts the socket connections and passes them off to be handled.

‘sock’ is an instance of ‘socket’. ‘fd’ is an open file descriptor for the current connection. ‘events’ is an integer of the number of events on the socket.

blackhole.connection.write_response(stream, mail_state, resp)[source]

Write the response back to the stream

Table Of Contents

Previous topic

Response codes

Next topic

blackhole.data

This Page