use of com.biglybt.core.networkmanager.OutgoingMessageQueue in project BiglyBT by BiglySoftware.
the class HTTPNetworkConnection method flushRequestsSupport.
protected void flushRequestsSupport(final flushListener l) {
OutgoingMessageQueue omq = getConnection().getOutgoingMessageQueue();
final Message http_message = new HTTPMessage(new byte[0]);
omq.registerQueueListener(new OutgoingMessageQueue.MessageQueueListener() {
@Override
public boolean messageAdded(Message message) {
return (true);
}
@Override
public void messageQueued(Message message) {
}
@Override
public void messageRemoved(Message message) {
}
@Override
public void messageSent(Message message) {
if (message == http_message) {
l.flushed();
}
}
@Override
public void protocolBytesSent(int byte_count) {
}
@Override
public void dataBytesSent(int byte_count) {
}
@Override
public void flush() {
}
});
omq.addMessage(http_message, false);
if (omq.getTotalSize() == 0) {
l.flushed();
}
}
Aggregations