Add missing .clang-format, and fix some spaces that slipped through.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4856 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -28,7 +28,7 @@ static void _tf_ssb_connections_changed_callback(tf_ssb_t* ssb, tf_ssb_change_t
|
||||
{
|
||||
char key[k_id_base64_len];
|
||||
if (tf_ssb_connection_get_host(connection) && *tf_ssb_connection_get_host(connection) && tf_ssb_connection_get_port(connection) &&
|
||||
tf_ssb_connection_get_id(connection, key, sizeof(key)))
|
||||
tf_ssb_connection_get_id(connection, key, sizeof(key)))
|
||||
{
|
||||
tf_ssb_connections_set_attempted(connections, tf_ssb_connection_get_host(connection), tf_ssb_connection_get_port(connection), key);
|
||||
}
|
||||
@ -53,8 +53,8 @@ static bool _tf_ssb_connections_get_next_connection(tf_ssb_connections_t* connec
|
||||
bool result = false;
|
||||
sqlite3_stmt* statement;
|
||||
sqlite3* db = tf_ssb_acquire_db_reader(connections->ssb);
|
||||
if (sqlite3_prepare(db, "SELECT host, port, key FROM connections WHERE last_attempt IS NULL OR (strftime('%s', 'now') - last_attempt > ?1) ORDER BY last_attempt LIMIT 1",
|
||||
-1, &statement, NULL) == SQLITE_OK)
|
||||
if (sqlite3_prepare(db, "SELECT host, port, key FROM connections WHERE last_attempt IS NULL OR (strftime('%s', 'now') - last_attempt > ?1) ORDER BY last_attempt LIMIT 1", -1,
|
||||
&statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_bind_int(statement, 1, 60000) == SQLITE_OK && sqlite3_step(statement) == SQLITE_ROW)
|
||||
{
|
||||
@ -179,11 +179,10 @@ static void _tf_ssb_connections_update_work(uv_work_t* work)
|
||||
sqlite3* db = tf_ssb_acquire_db_writer(update->ssb);
|
||||
if (update->attempted)
|
||||
{
|
||||
if (sqlite3_prepare(db, "UPDATE connections SET last_attempt = strftime('%s', 'now') WHERE host = ?1 AND port = ?2 AND key = ?3", -1, &statement, NULL) ==
|
||||
SQLITE_OK)
|
||||
if (sqlite3_prepare(db, "UPDATE connections SET last_attempt = strftime('%s', 'now') WHERE host = ?1 AND port = ?2 AND key = ?3", -1, &statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_bind_text(statement, 1, update->host, -1, NULL) == SQLITE_OK && sqlite3_bind_int(statement, 2, update->port) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_step(statement) != SQLITE_DONE)
|
||||
{
|
||||
@ -195,11 +194,10 @@ static void _tf_ssb_connections_update_work(uv_work_t* work)
|
||||
}
|
||||
else if (update->succeeded)
|
||||
{
|
||||
if (sqlite3_prepare(db, "UPDATE connections SET last_success = strftime('%s', 'now') WHERE host = ?1 AND port = ?2 AND key = ?3", -1, &statement, NULL) ==
|
||||
SQLITE_OK)
|
||||
if (sqlite3_prepare(db, "UPDATE connections SET last_success = strftime('%s', 'now') WHERE host = ?1 AND port = ?2 AND key = ?3", -1, &statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_bind_text(statement, 1, update->host, -1, NULL) == SQLITE_OK && sqlite3_bind_int(statement, 2, update->port) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_step(statement) != SQLITE_DONE)
|
||||
{
|
||||
@ -214,7 +212,7 @@ static void _tf_ssb_connections_update_work(uv_work_t* work)
|
||||
if (sqlite3_prepare(db, "INSERT INTO connections (host, port, key) VALUES (?1, ?2, ?3) ON CONFLICT DO NOTHING", -1, &statement, NULL) == SQLITE_OK)
|
||||
{
|
||||
if (sqlite3_bind_text(statement, 1, update->host, -1, NULL) == SQLITE_OK && sqlite3_bind_int(statement, 2, update->port) == SQLITE_OK &&
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
sqlite3_bind_text(statement, 3, update->key, -1, NULL) == SQLITE_OK)
|
||||
{
|
||||
int r = sqlite3_step(statement);
|
||||
if (r != SQLITE_DONE)
|
||||
|
Reference in New Issue
Block a user