known++;
} else if (!strcasecmp(type, "text/disconnect-notice")) {
running = thread_running = 0;
+ known++;
+ } else if (!strcasecmp(type, "text/event-plain")) {
+ char *foo;
+ esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
+ printf("RECV EVENT\n%s\n", foo);
+ free(foo);
+
known++;
}
}
signal(SIGINT, handle_SIGINT);
- handle.debug = 0;
esl_global_set_default_logger(6); /* default debug level to 6 (info) */
for(;;) {
esl_event_serialize(handle->last_ievent, &txt, ESL_TRUE);
- if (handle->debug) {
- esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
- }
-
+ esl_log(ESL_LOG_DEBUG, "SEND EVENT\n%s\n", txt);
+
send(handle->sock, "sendevent\n", 10, 0);
send(handle->sock, txt, strlen(txt), 0);
send(handle->sock, "\n\n", 2, 0);
if (hname && hval) {
esl_url_decode(hval);
- if (handle->debug > 1) {
- esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
- }
+ esl_log(ESL_LOG_DEBUG, "RECV HEADER [%s] = [%s]\n", hname, hval);
esl_event_add_header_string(revent, ESL_STACK_BOTTOM, hname, hval);
}
if (hname && hval) {
esl_url_decode(hval);
-
- if (handle->debug > 1) {
- esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
- }
+ esl_log(ESL_LOG_DEBUG, "RECV INNER HEADER [%s] = [%s]\n", hname, hval);
esl_event_add_header_string(handle->last_ievent, ESL_STACK_BOTTOM, hname, hval);
}
handle->last_ievent->body = body;
}
-
- if (handle->debug) {
+
+ if (esl_log_level >= 7) {
char *foo;
esl_event_serialize(handle->last_ievent, &foo, ESL_FALSE);
esl_log(ESL_LOG_DEBUG, "RECV EVENT\n%s\n", foo);
}
}
- if (handle->debug) {
+ if (esl_log_level >= 7) {
char *foo;
esl_event_serialize(revent, &foo, ESL_FALSE);
esl_log(ESL_LOG_DEBUG, "RECV MESSAGE\n%s\n", foo);
{
const char *e = cmd + strlen(cmd) -1;
- if (handle->debug) {
- esl_log(ESL_LOG_DEBUG, "SEND\n%s\n", cmd);
- }
+ esl_log(ESL_LOG_DEBUG, "SEND\n%s\n", cmd);
if (send(handle->sock, cmd, strlen(cmd), 0) != (int)strlen(cmd)) {
strerror_r(handle->errnum, handle->err, sizeof(handle->err));