/** * Called by an HighLevelReader when download is successfully finished. */ void HighLevelHttpConnection::downloadSuccess(MAHandle handle) { close(); deleteReader(); deallocateData(); dataDownloaded(handle, RES_OK); }
/** * Called by an HighLevelReader when there is a download error. */ void HighLevelHttpConnection::downloadError(int result) { close(); deleteReader(); deallocateData(); dataDownloaded(0, result); }
int main(void) { FILE *f; struct reader_t *r; f = fopen("CL_Images", "rb"); if (f == NULL) { fprintf(stderr, "Failed to open CL_Images: %s\n", strerror(errno)); return 1; } r = newReader(f); unpack(r, unpackCB); deleteReader(r); fclose(f); return 0; }
/** * This method is called when the HTTP request is complete. * Now all data is sent to the server and we can start reading * the reply and download data. */ void HighLevelHttpConnection::httpFinished( MAUtil::HttpConnection* connection, int result) { // Known success status codes are 200 and 201. if (200 != result && 201 != result) { // There was an error. dataDownloaded(0, result); return; } // Start to read the result using a DownloadReader helper object. deleteReader(); mReader = new HighLevelReaderThatReadsChunks(this); mReader->startRecvToData(); // Next this that happens is that connReadFinished is called. }
~OutputProxyPort() { deleteReader(); port->disconnect(); }