Forum Discussion

Tiaan_92076's avatar
Tiaan_92076
Icon for Nimbostratus rankNimbostratus
Aug 18, 2009

How to determine last segment in reaseembled TCP packet

I need to detach the load balancing decision after a transaction is completed on a member in the pool. The transaction occasionally spans multiple TCP segments causing the SERVER_DATA event to be raised more than once for the same transaction. With "LB::detach" in the "SERVER_DATA" event the transaction fails when this happens.

Implementing the "if" statement to check if the payload ends with a certain string and then calling "TCP::notify response" to run "LB::detach" in the "USER_RESPONSE" event solves the problem. Example below from the documentation.

     
  when SERVER_DATA {  
     log local0.debug "Received SERVER response ... [TCP::payload]"  
     if { [TCP::payload] ends_with $EOT } {  
        TCP::notify response  
     }  
     TCP::release  
     TCP::collect  
  }  
  
  when USER_RESPONSE {  
     LB::detach  
     log local0.debug "Detaches server connection ... "  
     if {[TCP::payload length] > 0} {  
          
         %TODO%  
         Process additional client requests here ...  
          
     }  
  }  
 

Can the same be done without checking the payload ? Possibly an event fired when the last segment is received ? I could not find this in the documentation though.

Thanks

18 Replies