private void cleanup() { stopTimer(); // Make sure timer stopped try { acceptReplies = false; conn?.removeMessage(this); // Empty out any accumuluated replies if (replies != null) { while (replies.Count != 0) { var temp_object = replies[0]; replies.RemoveAt(0); object generatedAux = temp_object; } } } catch (Exception ex) { // nothing } // Let GC clean up this stuff, leave name in case finalized is called conn = null; msg = null; // agent = null; // leave this reference queue = null; //replies = null; //leave this since we use it as a semaphore bindprops = null; }
/// <summary> Send a request to the server. A Message class is created /// for the specified request which causes the message to be sent. /// The request is added to the list of messages being managed by /// this agent. /// /// </summary> /// <param name="conn">the connection that identifies the server. /// /// </param> /// <param name="msg">the LdapMessage to send /// /// </param> /// <param name="timeOut">the interval to wait for the message to complete or /// <code>null</code> if infinite. /// </param> /// <param name="queue">the LdapMessageQueue associated with this request. /// </param> /* package */ internal void sendMessage(Connection conn, LdapMessage msg, int timeOut, LdapMessageQueue queue, BindProperties bindProps) { // creating a messageInfo causes the message to be sent // and a timer to be started if needed. Message message = new Message(msg, timeOut, conn, this, queue, bindProps); messages.Add(message); message.sendMessage(); // Now send message to server }
private BindProperties bindprops; // Bind properties if a bind request internal Message(LdapMessage msg, int mslimit, Connection conn, MessageAgent agent, LdapMessageQueue queue, BindProperties bindprops) { InitBlock(); this.msg = msg; this.conn = conn; this.agent = agent; this.queue = queue; this.mslimit = mslimit; msgId = msg.MessageID; this.bindprops = bindprops; }