struct memcached_ascii_connection *conn = (struct memcached_ascii_connection *)_conn;
if (!success) {
- i_error("memcached_ascii: connect(%s, %u) failed: %m",
- net_ip2addr(&conn->dict->ip), conn->dict->port);
+ e_error(conn->conn.event, "connect() failed: %m");
}
if (conn->dict->dict.ioloop != NULL)
io_loop_stop(conn->dict->dict.ioloop);
return -1;
}
+ dict->conn.conn.event_parent = dict->dict.event;
connection_init_client_ip(memcached_ascii_connections, &dict->conn.conn,
NULL, &dict->ip, dict->port);
+ event_set_append_log_prefix(dict->conn.conn.event, "memcached: ");
dict->dict = *driver;
dict->conn.reply_str = str_new(default_pool, 256);
dict->conn.dict = dict;
return 0;
if (data[0] != MEMCACHED_REPLY_HDR_MAGIC) {
- i_error("memcached: Invalid reply magic: %u != %u",
+ e_error(conn->conn.event, "Invalid reply magic: %u != %u",
data[0], MEMCACHED_REPLY_HDR_MAGIC);
return -1;
}
data_type = data[5];
memcpy(&status, data+6, 2); status = ntohs(status);
if (data_type != MEMCACHED_DATA_TYPE_RAW) {
- i_error("memcached: Unsupported data type: %u != %u",
+ e_error(conn->conn.event, "Unsupported data type: %u != %u",
data[0], MEMCACHED_DATA_TYPE_RAW);
return -1;
}
key_pos = MEMCACHED_REPLY_HDR_LENGTH + extras_len;
value_pos = key_pos + key_len;
if (value_pos > body_len) {
- i_error("memcached: Invalid key/extras lengths");
+ e_error(conn->conn.event, "Invalid key/extras lengths");
return -1;
}
conn->reply.value = data + value_pos;
(struct memcached_connection *)_conn;
if (!success) {
- i_error("memcached: connect(%s, %u) failed: %m",
- net_ip2addr(&conn->dict->ip), conn->dict->port);
+ e_error(conn->conn.event, "connect() failed: %m");
} else {
conn->dict->connected = TRUE;
}
return -1;
}
+ dict->conn.conn.event_parent = dict->dict.event;
+
connection_init_client_ip(memcached_connections, &dict->conn.conn,
NULL, &dict->ip, dict->port);
+ event_set_append_log_prefix(dict->conn.conn.event, "memcached: ");
dict->dict = *driver;
dict->conn.cmd = buffer_create_dynamic(default_pool, 256);
dict->conn.dict = dict;
static void memcached_dict_lookup_timeout(struct memcached_dict *dict)
{
- i_error("memcached: Lookup timed out in %u.%03u secs",
+ e_error(dict->dict.event, "Lookup timed out in %u.%03u secs",
dict->timeout_msecs/1000, dict->timeout_msecs%1000);
io_loop_stop(dict->dict.ioloop);
}
if (dict->conn.conn.fd_in == -1 &&
connection_client_connect(&dict->conn.conn) < 0) {
- i_error("memcached: Couldn't connect to %s:%u",
- net_ip2addr(&dict->ip), dict->port);
+ e_error(dict->conn.conn.event, "Couldn't connect");
} else {
to = timeout_add(dict->timeout_msecs,
memcached_dict_lookup_timeout, dict);
/* we failed in some way. make sure we disconnect since the
connection state isn't known anymore */
memcached_conn_destroy(&dict->conn.conn);
- *error_r = "memcached: Communication failure";
+ *error_r = "Communication failure";
return -1;
}
switch (dict->conn.reply.status) {
case MEMCACHED_RESPONSE_NOTFOUND:
return 0;
case MEMCACHED_RESPONSE_INTERNALERROR:
- *error_r = "memcached: Lookup failed: Internal error";
+ *error_r = "Lookup failed: Internal error";
return -1;
case MEMCACHED_RESPONSE_BUSY:
- *error_r = "memcached: Lookup failed: Busy";
+ *error_r = "Lookup failed: Busy";
return -1;
case MEMCACHED_RESPONSE_TEMPFAILURE:
- *error_r = "memcached: Lookup failed: Temporary failure";
+ *error_r = "Lookup failed: Temporary failure";
return -1;
}
- *error_r = t_strdup_printf("memcached: Lookup failed: Error code=%u",
+ *error_r = t_strdup_printf("Lookup failed: Error code=%u",
dict->conn.reply.status);
return -1;
}