PersistentConnection.cpp Outline - Grade-A-Software/Comcast-DASH-VLC GitHub Wiki

This class inherits from HttpConnection.

public members:

int read ( void *p_buffer, size_t len )

returns -1 for failure (chunk absence, chunk emptiness, reconnect failure)
returns 0 for successful chunk read.

std::string prepareRequest (Chunk *chunk)

returns an http GET request string formatted from the specified chunk data

bool PersistentConnection::init (Chunk *chunk)

returns true if connection initialized, false otherwise

bool addChunk (Chunk *chunk)

returns true if specified chunk pushed successfully to the local chunk queue

bool initChunk (Chunk *chunk)

Attempts to parse the local header (inherited from httpConnection), if successful returns -1.
Then attempts to reconnect, if fails, returns 0.
Then attempts to parse the local header again, if successful returns -1.

bool reconnect (Chunk *chunk)

attempts to resend all http requests a designated number of times (RETRY variable), returns true when requests are successful, otherwise returns false.

protected members:

string& getHostName () const

returns this connection's host name

bool isConnected () const

returns whether the connection is active

bool resendAllRequests ()

if all the requests stored in the local Chunk queue are sent successfully, return true, else return false.