correctly reassigning valid leases

This commit is contained in:
Martin Willi
2008-05-09 12:22:20 +00:00
parent 9f9903a3b3
commit f3bcd7f041
+2 -1
View File
@@ -96,9 +96,10 @@ static host_t* get_lease(private_sql_attribute_t *this,
"JOIN identities AS i ON l.identity = i.id "
"WHERE p.name = ? AND i.type = ? AND i.data = ? "
"AND (l.release ISNULL OR p.timeout ISNULL "
" OR (l.release < (p.timeout + l.acquire))) "
" OR (l.release >= (? - p.timeout))) "
"ORDER BY l.acquire LIMIT 1", DB_TEXT, name,
DB_INT, id->get_type(id), DB_BLOB, id->get_encoding(id),
DB_UINT, time(NULL),
DB_INT, DB_BLOB);
if (e)
{