attach uuid to search results

This commit is contained in:
Zlatin Balevsky
2019-06-01 07:20:39 +01:00
parent 77fac612cc
commit d2231b8e38
3 changed files with 5 additions and 3 deletions

View File

@@ -204,7 +204,7 @@ class ConnectionAcceptor {
byte [] payload = new byte[jsonSize]
dis.readFully(payload)
def json = slurper.parse(payload)
eventBus.publish(ResultsParser.parse(sender, json))
eventBus.publish(ResultsParser.parse(sender, resultsUUID, json))
}
} catch (IOException | UnexpectedResultsException | InvalidSearchResultException bad) {
log.log(Level.WARNING, "failed to process POST", bad)

View File

@@ -9,7 +9,7 @@ import com.muwire.core.util.DataUtil
import net.i2p.data.Base64
class ResultsParser {
public static UIResultEvent parse(Persona p, def json) throws InvalidSearchResultException {
public static UIResultEvent parse(Persona p, UUID uuid, def json) throws InvalidSearchResultException {
if (json.type != "Result")
throw new InvalidSearchResultException("not a result json")
if (json.version != 1)
@@ -46,7 +46,8 @@ class ResultsParser {
name : name,
size : size,
infohash : parsedIH,
pieceSize : pieceSize)
pieceSize : pieceSize,
uuid : uuid)
} catch (Exception e) {
throw new InvalidSearchResultException("parsing search result failed",e)
}

View File

@@ -6,6 +6,7 @@ import com.muwire.core.Persona
class UIResultEvent extends Event {
Persona sender
UUID uuid
String name
long size
InfoHash infohash