Skip to content

Commit

Permalink
adds more logic to session proc 2
Browse files Browse the repository at this point in the history
  • Loading branch information
falconair committed May 23, 2011
1 parent ddb559f commit f552e7a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 2 deletions.
46 changes: 44 additions & 2 deletions handlers/sessionProcessor2.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exports.newTemplate= function(isAcceptor,isDuplicate,isAuthentic,getSeqNums, rec

var fixutil = require('./fixutils.js');


//TODO make sure 'ignored' messages really are not forwarded to the next handler
function template(isAcceptor,isDuplicate,isAuthentic,getSeqNums,recordMsg){
var isInitiator = !isAcceptor;

Expand Down Expand Up @@ -165,8 +165,50 @@ function template(isAcceptor,isDuplicate,isAuthentic,getSeqNums,recordMsg){
//greater than expected
else{
//is it resend request?
...?
if(msgType === '2'){
//TODO get list of msgs from archive and send them out, but gap fill admin msgs
}

//did we already send a resend request?
if(self.isResendRequested === false){
self.isResendRequested = true;
ctx.sendPrev({data:{'35':'2', '7':self.incomingSeqNum, '16':'0'}, type:'data'});
}

//send resend-request
}

//==Process sequence-reset with gap-fill
if(msgType === '4' && fix['123'] === 'Y'){
var newSeqNoStr = fix['36'];
var newSeqNo = parseInt(newSeqNoStr,10);

if(newSeqNo >= self.incomingSeqNum){
self.incomingSeqNum = newSeqNo;
}
else{
var error = '[ERROR] Seq-reset may not decrement sequence numbers: ' + raw;
sys.log(error);
ctx.stream.end();
ctx.sendNext({data:error, type:'error'});
return;
}
}

//==Check compids and version
//TODO

//==Process test request
if(msgType === '1'){
var testReqID = fix['112'];
ctx.sendPrev({data:{'35':'0', '112':testReqID}, type:'data'});
}

//==Process resend-request
//TODO

//==Process logout
//TODO

}

Expand Down
1 change: 1 addition & 0 deletions resources/fixsessionalgorithm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ else if inSeqNum < expectedInSeqNum and posdup is Y
else if inSeqNum < expectedInSeqNum and posdup is undefined or N
ignore msg
error "manual intervention needed!"
send [logout] with error reason
disconnect connection
else if inSeqNum > expectedInSeqNum
ignore msg
Expand Down

0 comments on commit f552e7a

Please sign in to comment.