void buff_post(void *x, t_buff_info *buff) { if (buff->has_obj == false) { POST("Buffer \"%s\" not found.", buff->sym->s_name); } else { POST("Buffer \"%s\": Channels: %i - Frames: %i - Samplerate (smp / ms): %f", buff->sym->s_name, buff->ch_cnt, buff->fr_cnt, buff->msr); } }
void BST<T>::POST (const TreeNode<T> *n) const { if (n != NULL) { POST (n->left); POST (n->right); std::cout << n->v << " "; } }
atf_error_t atf_error_new(const char *type, void *data, size_t datalen, void (*format)(const atf_error_t, char *, size_t)) { atf_error_t err; PRE(!error_on_flight); PRE(data != NULL || datalen == 0); PRE(datalen != 0 || data == NULL); err = malloc(sizeof(*err)); if (err == NULL) err = atf_no_memory_error(); else { if (!error_init(err, type, data, datalen, format)) { free(err); err = atf_no_memory_error(); } else { err->m_free = true; error_on_flight = true; } } INV(err != NULL); POST(error_on_flight); return err; }
void _defer_delete(t_filesys *x, t_symbol *sym, long argc, t_atom *argv) { TRACE("_defer_delete"); char str_cur[MAX_PATH_CHARS]; t_symbol *sym_cur = atom_getsym(argv); _filesys_get_path(x, sym_cur->s_name, str_cur); // Try deleting the file int err = 0; #ifdef WIN_VERSION err = remove(str_cur); #endif #ifdef MAC_VERSION err = remove(str_cur); #endif // In case of success if (!err) { if (x->a_verbose) { POST("Removing: %s", sym_cur->s_name); } } // ... otherwise post an error message else { switch (errno) { case EACCES: MY_ERR("delete: File is open or read-only: \"%s\"", sym_cur->s_name); break; case ENOENT: MY_ERR("delete: File not found: \"%s\"", sym_cur->s_name); break; default: MY_ERR("delete: Unknown error: %i", errno); break; } } // Send a 0 or 1 message to indicate failure or success outlet_int(x->outl_return, err ? 0 : 1); }
void _dict_recurse_value_find(t_dict_recurse *x, t_atom *value, const char* str) { TRACE("_dict_recurse_value_find"); switch (x->command) { case CMD_FIND_KEY: if (x->has_match) { POST(" %s %s", x->path, str); } x->has_match = false; // reset matching state case CMD_FIND_KEY_IN: if (x->has_match) { POST(" %s %s", x->path, str); } break; default: break; } }
const char * dns_rpz_policy2str(dns_rpz_policy_t policy) { const char *str; switch (policy) { case DNS_RPZ_POLICY_PASSTHRU: str = "PASSTHRU"; break; case DNS_RPZ_POLICY_NXDOMAIN: str = "NXDOMAIN"; break; case DNS_RPZ_POLICY_NODATA: str = "NODATA"; break; case DNS_RPZ_POLICY_RECORD: str = "Local-Data"; break; case DNS_RPZ_POLICY_CNAME: case DNS_RPZ_POLICY_WILDCNAME: str = "CNAME"; break; default: str = ""; POST(str); INSIST(0); } return (str); }
atf_error_t atf_process_stream_init_inherit(atf_process_stream_t *sb) { sb->m_type = atf_process_stream_type_inherit; POST(stream_is_valid(sb)); return atf_no_error(); }
size_t streaming_readfunc(void* ptr, size_t size, size_t nmemb, void* stream) { LOG(LOG_INFO, "entry\n"); IOBuf* b = (IOBuf*)stream; ObjectStream* os = (ObjectStream*)b->user_data; size_t total = (size * nmemb); LOG(LOG_INFO, "(%08lx) curl buff %ld\n", (size_t)os, total); // wait for producer to fill buffers WAIT(&os->iob_full); LOG(LOG_INFO, "(%08lx) avail-data: %ld\n", (size_t)os, b->avail); // maybe we were requested to quit or abort? if (b->write_count == 0) { // called by stream_sync() LOG(LOG_INFO, "(%08lx) got EOF\n", (size_t)os); POST(&os->iob_empty); // polite return 0; } else if (b->first->buf == (char*)1) { // called by stream_abort() LOG(LOG_INFO, "(%08lx) got ABORT\n", (size_t)os); POST(&os->iob_empty); // polite return CURL_READFUNC_ABORT; } // move producer's data into curl buffers. // (Might take more than one callback) size_t move_req = ((total <= b->avail) ? total : b->avail); size_t moved = aws_iobuf_get_raw(b, (char*)ptr, move_req); // track total size os->written += moved; LOG(LOG_INFO, "(%08lx) moved %ld (total: %ld)\n", (size_t)os, moved, os->written); if (b->avail) { LOG(LOG_INFO, "(%08lx) iterating (avail: %ld)\n", (size_t)os, b->avail); POST(&os->iob_full); // next callback is pre-approved } else { LOG(LOG_INFO, "(%08lx) done with buffer (total written %ld)\n", (size_t)os, os->written); POST(&os->iob_empty); // tell producer that buffer is used } return moved; }
atf_error_t atf_process_stream_init_capture(atf_process_stream_t *sb) { sb->m_type = atf_process_stream_type_capture; POST(stream_is_valid(sb)); return atf_no_error(); }
/*% parses a file and fills in the data structure. */ lwres_result_t lwres_conf_parse(lwres_context_t *ctx, const char *filename) { FILE *fp = NULL; char word[256]; lwres_result_t rval, ret; lwres_conf_t *confdata; int stopchar; REQUIRE(ctx != NULL); confdata = &ctx->confdata; REQUIRE(filename != NULL); REQUIRE(strlen(filename) > 0U); REQUIRE(confdata != NULL); errno = 0; if ((fp = fopen(filename, "r")) == NULL) return (LWRES_R_NOTFOUND); ret = LWRES_R_SUCCESS; do { stopchar = getword(fp, word, sizeof(word)); if (stopchar == EOF) { rval = LWRES_R_SUCCESS; POST(rval); break; } if (strlen(word) == 0U) rval = LWRES_R_SUCCESS; else if (strcmp(word, "nameserver") == 0) rval = lwres_conf_parsenameserver(ctx, fp); else if (strcmp(word, "lwserver") == 0) rval = lwres_conf_parselwserver(ctx, fp); else if (strcmp(word, "domain") == 0) rval = lwres_conf_parsedomain(ctx, fp); else if (strcmp(word, "search") == 0) rval = lwres_conf_parsesearch(ctx, fp); else if (strcmp(word, "sortlist") == 0) rval = lwres_conf_parsesortlist(ctx, fp); else if (strcmp(word, "options") == 0) rval = lwres_conf_parseoption(ctx, fp); else { /* unrecognised word. Ignore entire line */ rval = LWRES_R_SUCCESS; stopchar = eatline(fp); if (stopchar == EOF) { break; } } if (ret == LWRES_R_SUCCESS && rval != LWRES_R_SUCCESS) ret = rval; } while (1); fclose(fp); return (ret); }
/// Initializes the global state of the CLI. /// /// This function can only be called once during the execution of a program, /// unless override_for_testing is set to true. /// /// \param argv0 The value of argv[0]; i.e. the program name. /// \param override_for_testing Should always be set to false unless for tests /// of this functionality, which may set this to true to redefine internal /// state. void cmdline::init(const char* argv0, const bool override_for_testing) { if (!override_for_testing) PRE_MSG(Progname.empty(), "cmdline::init called more than once"); Progname = utils::fs::path(argv0).leaf_name(); LD(F("Program name: %s") % Progname); POST(!Progname.empty()); }
atf_error_t atf_process_stream_init_redirect_fd(atf_process_stream_t *sb, const int fd) { sb->m_type = atf_process_stream_type_redirect_fd; sb->m_fd = fd; POST(stream_is_valid(sb)); return atf_no_error(); }
atf_error_t atf_process_stream_init_redirect_path(atf_process_stream_t *sb, const atf_fs_path_t *path) { sb->m_type = atf_process_stream_type_redirect_path; sb->m_path = path; POST(stream_is_valid(sb)); return atf_no_error(); }
void atomsFromPackPrivate(ListCount count, t_atom* listReturn, Pack* pack, unsigned int* index) { POST("count: %i, index: %i", count, (*index)); listReturn[(*index)] = pack->name; /*char buf[256]; atom_string(& listReturn[*index],buf, 256); POST("Writing: [%i] = %s",*index,buf);*/ unsigned int indexStart = (*index); (*index) += 2; ElementPackOrAtom* pElement=ListPackOrAtomGetFirst( & pack -> listSub); if(pElement) { do { PackOrAtom* pPackOrAtom= pElement -> pData; if(pPackOrAtom->isAtom) { listReturn[*index] = pPackOrAtom->atom; /*char buf[256]; atom_string(& listReturn[*index],buf, 256); POST("Writing: [%i] = %s",*index,buf);*/ (*index) += 1; } else { atomsFromPackPrivate( count- (*index), listReturn, &pPackOrAtom->pack, index); //POST("end recursion!"); /*POST("INFO:"); char hurz[256]; atom_string(listReturn+temp,hurz,256); post(hurz);*/ } pElement = ListPackOrAtomGetNext( &pack->listSub, pElement); } while(pElement); } SETFLOAT(&listReturn[indexStart+1], (*index)-indexStart-2); /*char buf2[256]; atom_string(& listReturn[indexStart+1], buf2, 256); POST("Writing: [%i] = %s",indexStart+1,buf2);*/ /* char buf3[256] = ""; //POST("indexStart: %i",indexStart,count for(int i = indexStart; i < indexStart+count; i++) { atom_string(listReturn+i,buf3,256); //post(buf3); POST("\tatomList[%i]: %s", i, buf3); } */ }
void dict_re_simulate(t_dict_recurse *x, t_symbol *sym, long argc, t_atom *argv) { TRACE("dict_re_simulate"); t_bool test = re_simulate(x->re2, atom_getsym(argv)->s_name); MY_ASSERT(x->re2->err != ERR_NONE, "Simulation error."); POST("Search: %s - Match: %s%s%s - %s", x->re2->re_search_s, atom_getsym(argv)->s_name, (x->re2->repl_sub_cnt) ? " - Replace: " : "", (x->re2->repl_sub_cnt) ? x->re2->replace_p : "", test ? "MATCH" : "NO MATCH"); }
String thethingsiOClient::send() { String received = ""; if (POST(regular_client, "/v2/things/" + token, "{\"values\":[" + data + "]}")) { data = ""; delay(1000); while (regular_client->available()) { char c = (char)regular_client->read(); received.concat(c); } } return received; }
void dict_re_compile(t_dict_recurse *x, t_symbol *sym, long argc, t_atom *argv) { TRACE("dict_re_compile"); if (argc == 1) { re_compile(x->re2, atom_getsym(argv)->s_name, NULL); } else if (argc == 2) { re_compile(x->re2, atom_getsym(argv)->s_name, atom_getsym(argv + 1)->s_name); } MY_ASSERT(x->re2->err != ERR_NONE, "Compilation error."); POST("Compile: %s %s - RPN: %s - States: %i - Flags: %i - Substr: %i %s", x->re2->re_search_s, atom_getsym(argv + 1)->s_name, x->re2->rpn_s, x->re2->state_cnt, x->re2->capt_flags, x->re2->repl_sub_cnt, x->re2->repl_sub_s); }
// Accept as much as <size>, from the streaming GET, into caller's <buf>. // We may discover EOF at any time. In that case, we'll return however // much was actually read. The next call // will just short-circuit to return 0, signalling EOF to caller. // // return -1 with errno, for failures. // else return number of chars we get. // ssize_t stream_get(ObjectStream* os, char* buf, size_t size) { static const int get_timeout_sec = 10; /* totally made up out of thin air */ IOBuf* b = &os->iob; // shorthand LOG(LOG_INFO, "entry\n"); if (! (os->flags & OSF_OPEN)) { LOG(LOG_ERR, "%s isn't open\n", os->url); errno = EINVAL; /* ?? */ return -1; } if (! (os->flags & OSF_READING)) { LOG(LOG_ERR, "%s isn't open for reading\n", os->url); errno = EINVAL; /* ?? */ return -1; } if (os->flags & OSF_EOF) { LOG(LOG_INFO, "already at EOF\n"); return 0; // b->write_count; } os->flags &= ~(OSF_EOB); aws_iobuf_reset(b); // doesn't affect <user_data> aws_iobuf_extend_static(b, (char*)buf, size); LOG(LOG_INFO, "got %ld-byte buffer for writefn\n", size); // let writefn move data POST(&os->iob_empty); // wait for writefn to fill our buffer LOG(LOG_INFO, "waiting for writefn\n"); SAFE_WAIT(&os->iob_full, get_timeout_sec, os); // SAFE_WAIT_KILL(&os->iob_full, get_timeout_sec, os); // writefn detected CURL EOF? if (os->flags & OSF_EOF) { LOG(LOG_INFO, "EOF is asserted\n"); } if (os->flags & OSF_EOB) { LOG(LOG_INFO, "EOB is asserted\n"); } os->written += b->write_count; LOG(LOG_INFO, "returning %ld (total=%ld)\n", b->write_count, os->written); return (b->write_count); }
atf_error_t atf_process_stream_init_connect(atf_process_stream_t *sb, const int src_fd, const int tgt_fd) { PRE(src_fd >= 0); PRE(tgt_fd >= 0); PRE(src_fd != tgt_fd); sb->m_type = atf_process_stream_type_connect; sb->m_src_fd = src_fd; sb->m_tgt_fd = tgt_fd; POST(stream_is_valid(sb)); return atf_no_error(); }
void mouse_multi_click2(size_t num_clicks, CGPoint point) { CGEventRef base_event = NEW_EVENT( kCGEventLeftMouseDown, point, kCGMouseButtonLeft ); CGEventSetIntegerValueField(base_event, kCGMouseEventClickState, num_clicks); CHANGE(base_event, kCGEventLeftMouseDown); POST(base_event); CHANGE(base_event, kCGEventLeftMouseUp); POSTRELEASE(base_event); }
void *filesys_new(t_symbol *sym, long argc, t_atom *argv) { t_filesys *x = NULL; x = (t_filesys *)object_alloc(filesys_class); MY_ASSERT(!x, NULL, "Object allocation failed."); x->outl_return = bangout((t_object*)x); // Outlet 1: 0 or 1 for failure or success (int) x->outl_mess = outlet_new((t_object*)x, NULL); // Outlet 0: General messages _filesys_cd_patcher(x); POST("New object created: directory: %s", x->dir_s); return(x); }
static void initialize_var(struct var *var, const char *envname) { PRE(var->value == NULL); if (atf_env_has(envname)) { const char *val = atf_env_get(envname); if (strlen(val) > 0 || var->can_be_empty) var->value = val; else var->value = var->default_value; } else var->value = var->default_value; POST(var->value != NULL); }
String thethingsiOClient::activate(String activationCode) { token = ""; String body = ""; String find_token = "thingToken\":\""; int start; char c; if (POST(regular_client, "/v2/things/", "{ \"activationCode\":\"" + activationCode + "\"}")) { delay(1000); while (regular_client->available() && (c = (char)regular_client->read()) != '{'); if (c == '{') { while (regular_client->available() && (c = (char)regular_client->read()) != '\n') body.concat(c); if ((start = body.indexOf(find_token)) >= 0) { start = start + find_token.length(); token = body.substring(start, start + TOKEN_SIZE); } } } return token; }
void RegisterLayer::clickRegister(CCObject* pSender) { map<string,string> post; post["api"] = "sign_up"; post["username"] = usernameText->getString(); post["password"] = passwordText->getString(); post["role_type"] = Utils::int2str((int)USER->getRoleType()); post["level"] = Utils::int2str(USER->getLevel()); post["exp"] = Utils::int2str(USER->getExp()); post["basic_agi"] = Utils::int2str(USER->getBasicAGI()); post["basic_str"] = Utils::int2str(USER->getBasicSTR()); post["basic_def"] = Utils::int2str(USER->getBasicDEF()); post["current_weapon"] = Utils::int2str((int)USER->getEquipment().getWeapon()); post["current_base"] = Utils::int2str((int)USER->getEquipment().getBase()); post["current_plate"] = Utils::int2str((int)USER->getEquipment().getPlate()); post["open_chapters_number"] = Utils::int2str(USER->getOpenChaptersNumber()); post["win_online_game_number"] = Utils::int2str(USER->getWinOnlineGamesNumber()); post["play_online_game_number"] = Utils::int2str(USER->getPlayOnlineGamesNumber()); post["money"] = Utils::int2str(USER->getMoney()); post["honor"] = Utils::int2str(USER->getHonor()); std::string jsonStr = POST(post); JsonBox::Value data; CCLOG(jsonStr.c_str()); data.loadFromString(jsonStr); if(data["result"].getString()=="OK"){ USER->setUsername(usernameText->getString()); USER->setPassword(passwordText->getString()); USER->setHasSignin(true); USER->setIsBeginner(false); CCNode* parent = this->getParent(); this->removeFromParentAndCleanup(); INFORMATION_BOX(CN("register_and_login_successfully"),parent); } else if(data["result"].getString()=="Username existed"){ INFORMATION_BOX(CN("username_existed"),this); } else{ INFORMATION_BOX(CN("register_failed"),this); } }
// // Adds all predefined standard build-time variables to the m_variables // map, considering the values a user may have provided in the environment. // // Can only be called once during the program's lifetime. // static void init_variables(void) { PRE(m_variables.empty()); m_variables["atf_build_cc"] = atf_config_get("atf_build_cc"); m_variables["atf_build_cflags"] = atf_config_get("atf_build_cflags"); m_variables["atf_build_cpp"] = atf_config_get("atf_build_cpp"); m_variables["atf_build_cppflags"] = atf_config_get("atf_build_cppflags"); m_variables["atf_build_cxx"] = atf_config_get("atf_build_cxx"); m_variables["atf_build_cxxflags"] = atf_config_get("atf_build_cxxflags"); m_variables["atf_includedir"] = atf_config_get("atf_includedir"); m_variables["atf_libexecdir"] = atf_config_get("atf_libexecdir"); m_variables["atf_pkgdatadir"] = atf_config_get("atf_pkgdatadir"); m_variables["atf_shell"] = atf_config_get("atf_shell"); m_variables["atf_workdir"] = atf_config_get("atf_workdir"); POST(!m_variables.empty()); }
/** all (sym: dictionary) */ void dict_recurse_all(t_dict_recurse *x, t_symbol *dict_sym) { TRACE("dict_recurse_all"); // Initialize the object variables x->command = CMD_ALL; t_atom dict_ato[1]; atom_setsym(dict_ato, dict_sym); if (_dict_recurse_begin_cmd(x, dict_ato, gensym("all")) != ERR_NONE) { return; } // Start the recursion _dict_recurse_dict(x, x->dict, 0); // Post a summary for the command POST("all: %i reference%s found in \"%s\".", x->count, (x->count == 1) ? "" : "s", x->dict_sym->s_name); // End the command _dict_recurse_end_cmd(x); }
void LogIntoLayer::clickLogInto(CCObject* pSender) { map<string,string> post; post["api"] = "login"; post["username"]=usernameText->getString(); post["password"]=passwordText->getString(); std::string jsonStr = POST(post); JsonBox::Value data; CCLOG(jsonStr.c_str()); data.loadFromString(jsonStr); if(data["result"].getString()=="OK"){ CCLOG("Login Successfully!"); USER->setUserID(atoi(data["0"]["user_id"].getString().c_str())); USER->setUsername(data["0"]["username"].getString()); USER->setPassword(data["0"]["password"].getString()); USER->setLevel(atoi(data["0"]["level"].getString().c_str())); USER->setExp(atoi(data["0"]["exp"].getString().c_str())); USER->setBasicAGI(atoi(data["0"]["basic_agi"].getString().c_str())); USER->setBasicSTR(atoi(data["0"]["basic_str"].getString().c_str())); USER->setBasicDEF(atoi(data["0"]["basic_def"].getString().c_str())); Equipment* equipment = new Equipment(); equipment->setWeapon(Weapon(atoi(data["0"]["current_weapon"].getString().c_str()))); equipment->setBase(Base(atoi(data["0"]["current_base"].getString().c_str()))); equipment->setPlate(Plate(atoi(data["0"]["current_plate"].getString().c_str())));// USER->setOpenChaptersNumber(atoi(data["0"]["open_chapters_number"].getString().c_str())); USER->setWinOnlineGamesNumber(atoi(data["0"]["win_online_game_number"].getString().c_str())); USER->setPlayOnlineGamesNumber(atoi(data["0"]["play_online_game_number"].getString().c_str())); USER->setMoney(atoi(data["0"]["money"].getString().c_str())); CCLOG(data["0"]["money"].getString().c_str()); USER->setHonor(atoi(data["0"]["honor"].getString().c_str())); USER->setHasSignin(true); USER->setIsBeginner(false); USER->flush(); CCNode* parent = this->getParent(); this->removeFromParentAndCleanup(); INFORMATION_BOX("Login successfully!",parent); } else{ PopWindowsLayer::createInfomationBox("Login failed!",this); } }
void _defer_rename(t_filesys *x, t_symbol *sym, long argc, t_atom *argv) { TRACE("_defer_rename"); char str_cur[MAX_PATH_CHARS]; char str_new[MAX_PATH_CHARS]; t_symbol *sym_cur = atom_getsym(argv); t_symbol *sym_new = atom_getsym(argv + 1); _filesys_get_path(x, sym_cur->s_name, str_cur); _filesys_get_path(x, sym_new->s_name, str_new); // Try renaming the file int err = 0; #ifdef WIN_VERSION err = rename(str_cur, str_new); #endif #ifdef MAC_VERSION err = rename(str_cur, str_new); #endif // In case of success if (!err) { if (x->a_verbose) { POST("Renaming: %s to %s", sym_cur->s_name, sym_new->s_name); } } // ... otherwise post an error message else { switch (errno) { case ENOENT: MY_ERR("rename: File or destination folder not found: \"%s\" \"%s\"", sym_cur->s_name, sym_new->s_name); break; case EEXIST: MY_ERR("rename: Existing file with name: \"%s\"", sym_new->s_name); break; case EACCES: MY_ERR("rename: Access error: \"%s\"", sym_new->s_name); break; case EINVAL: MY_ERR("rename: Invalid characters: \"%s\" \"%s\"", sym_cur->s_name, sym_new->s_name); break; default: MY_ERR("rename: Unknown error: %i", errno); break; } } // Send a 0 or 1 message to indicate failure or success outlet_int(x->outl_return, err ? 0 : 1); }
int s3_op_internal(ObjectStream* os) { IOBuf* b = &os->iob; __attribute__ ((unused)) AWSContext* ctx = b->context; // run the GET or PUT int is_get = (os->flags & OSF_READING); if (is_get) { LOG(LOG_INFO, "GET '%s/%s/%s'\n", (ctx ? ctx->S3Host : "*"), (ctx ? ctx->Bucket : "*"), os->url); AWS4C_CHECK1( s3_get(b, os->url) ); /* create empty object with user metadata */ } else { LOG(LOG_INFO, "PUT '%s/%s/%s'\n", (ctx ? ctx->S3Host : "*"), (ctx ? ctx->Bucket : "*"), os->url); // If you are getting errors here, the comments above the "#if // ((LIBCURL_VERSION ...", in stream_sync(), *might* be relevant. AWS4C_CHECK1( s3_put(b, os->url) ); /* create empty object with user metadata */ } // s3_get with byte-range can leave streaming_writefunc() waiting for // a curl callback that never comes. This happens if there is still writable // space in the buffer, when the last bytes in the request are processed. // This can happen because caller (e.g. fuse) may ask for more bytes than are present, // and provide a buffer big enought o receive them. if (is_get && (b->code == 206)) { // should we do something with os->iob_full? set os->flags & EOF? LOG(LOG_INFO, "GET complete\n"); os->flags |= OSF_EOF; POST(&os->iob_full); return 0; } else if (AWS4C_OK(b) ) { LOG(LOG_INFO, "%s complete\n", ((is_get) ? "GET" : "PUT")); return 0; } LOG(LOG_ERR, "CURL ERROR: %lx %d '%s'\n", (size_t)b, b->code, b->result); return -1; }
// After EOF, fuse makes a callback to marfs_read() with a byte-range // beyond the end of the object. In that case, curl never calls // streaming_writefunc(), so stream_get() is stuck waiting for iob_full. // This function can detect that case, because the Content-length returned // in the header will be zero. size_t streaming_writeheaderfunc(void* ptr, size_t size, size_t nitems, void* stream) { size_t result = aws_headerfunc(ptr, size, nitems, stream); // if we've parsed content-length from the response-header, and length // was zero, then there will be no callback to streaming_writefunc(). // Therefore, streaming_writefunc() will never post iob_full, and // stream_get() will wait forever (or until it times out). We have // knowledge that this is happening, so we can post iob_full ourselves, // and let stream_get() proceed. if ( !strncmp( ptr, "Content-Length: ", 15 )) { IOBuf* b = (IOBuf*)stream; ObjectStream* os = (ObjectStream*)b->user_data; if (!b->contentLen) { LOG(LOG_INFO, "detected EOF\n"); // readfunc done with IOBuf? os->flags |= OSF_EOF; // (or error) POST(&os->iob_full); } else LOG(LOG_INFO, "content-length (%ld) is non-zero\n", b->contentLen); } return result; }