mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 22:59:54 +01:00
Changed the format of transport properties from (key, value) pairs to
(transport name, key, value) triples. This makes it possible for each transport plugin to update its locally stored properties atomically.
This commit is contained in:
@@ -3,6 +3,7 @@ package net.sf.briar.protocol.writers;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.sf.briar.api.protocol.Tags;
|
||||
import net.sf.briar.api.protocol.writers.TransportWriter;
|
||||
@@ -19,10 +20,21 @@ class TransportWriterImpl implements TransportWriter {
|
||||
w = writerFactory.createWriter(out);
|
||||
}
|
||||
|
||||
public void writeTransports(Map<String, String> transports)
|
||||
public void writeTransports(Map<String, Map<String, String>> transports)
|
||||
throws IOException {
|
||||
w.writeUserDefinedTag(Tags.TRANSPORTS);
|
||||
w.writeMap(transports);
|
||||
// Transport maps are always written in delimited form
|
||||
w.writeMapStart();
|
||||
for(Entry<String, Map<String, String>> e : transports.entrySet()) {
|
||||
w.writeString(e.getKey());
|
||||
w.writeMapStart();
|
||||
for(Entry<String, String> e1 : e.getValue().entrySet()) {
|
||||
w.writeString(e1.getKey());
|
||||
w.writeString(e1.getValue());
|
||||
}
|
||||
w.writeMapEnd();
|
||||
}
|
||||
w.writeMapEnd();
|
||||
w.writeInt64(System.currentTimeMillis());
|
||||
out.flush();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user