fix result sending and profile fetching

dbus-notify
Zlatin Balevsky 2022-05-31 20:38:26 +01:00
parent 388cad0b5d
commit 2c555f662a
No known key found for this signature in database
GPG Key ID: A72832072D525E41
2 changed files with 7 additions and 3 deletions

View File

@ -193,7 +193,7 @@ class ConnectionAcceptor {
processETTER(e)
break
case (byte)'A':
procesVATAR(e)
processVATAR(e)
default:
throw new Exception("Invalid read $read")
}
@ -805,7 +805,7 @@ class ConnectionAcceptor {
os.write("200 OK\r\n".getBytes(StandardCharsets.US_ASCII))
ByteArrayOutputStream baos = new ByteArrayInputStream()
ByteArrayOutputStream baos = new ByteArrayOutputStream()
profile.write(baos)
byte [] payload = baos.toByteArray()
os.write("Length:${payload.length}\r\n".getBytes(StandardCharsets.US_ASCII))
@ -814,6 +814,10 @@ class ConnectionAcceptor {
} catch (Exception bad) {
log.log(Level.WARNING, "failed to process AVATAR", bad)
} finally {
try {
e.getOutputStream().flush()
e.getOutputStream().close()
} catch (IOException ignore) {}
e.close()
}
}

View File

@ -176,7 +176,7 @@ class ResultsSender {
os.write("Messages: $messages\r\n".getBytes(StandardCharsets.US_ASCII))
MWProfileHeader header = myProfileHeader.get()
if (header != null)
os.write("ProfileHeader: ${myProfileHeader.toBase64()}\r\n".getBytes(StandardCharsets.US_ASCII))
os.write("ProfileHeader: ${header.toBase64()}\r\n".getBytes(StandardCharsets.US_ASCII))
os.write("\r\n".getBytes(StandardCharsets.US_ASCII))
dos = new DataOutputStream(new GZIPOutputStream(os))
results.each {