Rod Hynes 11 лет назад
Родитель
Сommit
eefd29deb4
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      psiphon/dataStore.go

+ 4 - 3
psiphon/dataStore.go

@@ -50,7 +50,7 @@ func initDataStore() {
              data blob not null);
              data blob not null);
 	    create table if not exists serverEntryProtocol
 	    create table if not exists serverEntryProtocol
 	        (serverEntryId text not null,
 	        (serverEntryId text not null,
-	         protocol text not null)
+	         protocol text not null);
         create table if not exists keyValue
         create table if not exists keyValue
             (key text not null,
             (key text not null,
              value text not null);
              value text not null);
@@ -159,7 +159,7 @@ func StoreServerEntry(serverEntry *ServerEntry, replaceIfExists bool) error {
 			requiredCapability := strings.TrimSuffix(protocol, "-OSSH")
 			requiredCapability := strings.TrimSuffix(protocol, "-OSSH")
 			if Contains(serverEntry.Capabilities, requiredCapability) {
 			if Contains(serverEntry.Capabilities, requiredCapability) {
 				_, err = transaction.Exec(`
 				_, err = transaction.Exec(`
-		            insert or ignore into serverEntryProtocol (id, protocol)
+		            insert or ignore into serverEntryProtocol (serverEntryId, protocol)
 		            values (?, ?);
 		            values (?, ?);
 		            `, serverEntry.IpAddress, protocol)
 		            `, serverEntry.IpAddress, protocol)
 				if err != nil {
 				if err != nil {
@@ -306,7 +306,8 @@ func makeServerEntryWhereClause(
 		} else {
 		} else {
 			whereClause += " where"
 			whereClause += " where"
 		}
 		}
-		whereClause += " exists (select 1 from serverEntryProtocol where protocol = ?)"
+		whereClause +=
+			" exists (select 1 from serverEntryProtocol where protocol = ? and serverEntryId = serverEntry.id)"
 		whereParams = append(whereParams, protocol)
 		whereParams = append(whereParams, protocol)
 	}
 	}
 	if len(excludeIds) > 0 {
 	if len(excludeIds) > 0 {