Changed drive monitors to use callbacks rather than blocking.

This commit is contained in:
akwizgran
2011-10-05 16:11:18 +01:00
parent 3a321b0f0e
commit f6df333796
12 changed files with 253 additions and 148 deletions

View File

@@ -1,5 +1,7 @@
package net.sf.briar.api.transport.batch;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId;
import net.sf.briar.api.transport.TransportCallback;
/**
@@ -8,7 +10,9 @@ import net.sf.briar.api.transport.TransportCallback;
*/
public interface BatchTransportCallback extends TransportCallback {
void readerCreated(BatchTransportReader r);
void readerCreated(ContactId contactId, byte[] encryptedIv,
BatchTransportReader r);
void writerCreated(BatchTransportWriter w);
void writerCreated(ContactId contactId, TransportId t, long connection,
BatchTransportWriter w);
}

View File

@@ -1,5 +1,6 @@
package net.sf.briar.api.transport.batch;
import java.io.IOException;
import java.util.Map;
import net.sf.briar.api.ContactId;
@@ -23,13 +24,13 @@ public interface BatchTransportPlugin {
void start(Map<String, String> localProperties,
Map<ContactId, Map<String, String>> remoteProperties,
Map<String, String> config, BatchTransportCallback c)
throws InvalidTransportException, InvalidConfigException;
throws InvalidTransportException, InvalidConfigException, IOException;
/**
* Stops the plugin. No further connections will be passed to the callback
* after this method has returned.
*/
void stop();
void stop() throws IOException;
/** Updates the plugin's local transport properties. */
void setLocalProperties(Map<String, String> properties)

View File

@@ -1,5 +1,7 @@
package net.sf.briar.api.transport.stream;
import net.sf.briar.api.ContactId;
import net.sf.briar.api.TransportId;
import net.sf.briar.api.transport.TransportCallback;
/**
@@ -8,5 +10,9 @@ import net.sf.briar.api.transport.TransportCallback;
*/
public interface StreamTransportCallback extends TransportCallback {
void connectionCreated(StreamTransportConnection c);
void incomingConnectionCreated(ContactId contactId, byte[] encryptedIv,
StreamTransportConnection c);
void outgoingConnectionCreated(ContactId contactId, TransportId t,
long connection, StreamTransportConnection c);
}