use of sugar.free.sightparser.error.InvalidServicePasswordError in project SightRemote by TebbeUbben.
the class RequestWorker method requestNext.
private void requestNext(Pipeline pipeline) {
if (messageRequests.size() == 0)
return;
MessageRequest messageRequest = null;
while (messageRequests.size() != 0) {
messageRequest = messageRequests.get(0);
if (!messageRequest.getBinder().isBinderAlive()) {
messageRequests.remove(messageRequest);
if (messageRequests.size() == 0)
return;
else
continue;
} else
break;
}
Service service = messageRequest.getAppLayerMessage().getService();
if (!pipeline.getActivatedServices().contains(service)) {
messageRequest.setMessageStatus(MessageStatus.ACTIVATING_SERVICE);
if (service.getServicePassword() != null) {
if (service.getServicePassword().length() != 16)
pipeline.receive(new InvalidServicePasswordError(messageRequest.getAppLayerMessage().getClass(), (short) 0x99F0));
else {
ServiceChallengeMessage serviceChallenge = new ServiceChallengeMessage();
serviceChallenge.setServiceID(service.getServiceID());
serviceChallenge.setVersion(service.getVersion());
pipeline.send(serviceChallenge);
}
} else {
ActivateServiceMessage activateService = new ActivateServiceMessage();
activateService.setServiceID(service.getServiceID());
activateService.setVersion(service.getVersion());
activateService.setServicePassword(new byte[16]);
pipeline.send(activateService);
}
} else {
messageRequest.setMessageStatus(MessageStatus.PENDING);
if (service.getServicePassword() != null && service.getServicePassword().length() != 16)
pipeline.receive(new InvalidServicePasswordError(messageRequest.getAppLayerMessage().getClass(), (short) 0x99F0));
else
pipeline.send(messageRequest.getAppLayerMessage());
}
}
Aggregations