protected boolean postMessage ( DownstreamMessage msg , PresentsConnection expect ) { PresentsConnection conn = getConnection ( ) ; // make sure that the connection they expect us to be using is the one we're using; there // are circumstances were sufficient delay between request and response gives the client // time to drop their original connection and establish a new one, opening the door to // major confusion if ( expect != null && conn != expect ) { return false ; } if ( _compound != null ) { _compound . msgs . add ( msg ) ; return true ; } // make sure we have a connection at all if ( conn != null ) { conn . postMessage ( msg ) ; _messagesOut ++ ; // count 'em up! return true ; } // don't log dropped messages unless we're dropping a lot of them (meaning something is // still queueing messages up for this dead client even though it shouldn't be) if ( ++ _messagesDropped % 50 == 0 ) { log . warning ( "Dropping many messages?" , "client" , this , "count" , _messagesDropped , "msg" , msg ) ; } // make darned sure we don't have any remaining subscriptions if ( _subscrips . size ( ) > 0 ) { // log.warning("Clearing stale subscriptions", "client", this, // "subscrips", _subscrips.size()); clearSubscrips ( _messagesDropped > 10 ) ; } return false ; }
Queues a message for delivery to the client .