Skip to content

Commit

Permalink
Handling of socket block on a TCP write by AgentDnsXmppChannel.
Browse files Browse the repository at this point in the history
Application should not free data sent over TCP socket as the TCP library takes care
of memory management of the data.

On a socket write block xmpp provides the facility to register a callback so application
can handle the case. In case of agent, the inherent TCP library buffering should be
sufficient and no action needed from the application as there is only one writer(DNS)
on the socket.

Change-Id: I73993d58ed84cdce97217038c3da17ac3f5142d2
Closes-Bug: 1561843
  • Loading branch information
nipak committed Apr 1, 2016
1 parent 22107b0 commit 204b64f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/vnsw/agent/controller/controller_dns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ bool AgentDnsXmppChannel::SendMsg(uint8_t *msg, std::size_t len) {
return false;

return channel_->Send((const uint8_t *)msg, len, xmps::DNS,
boost::bind(&AgentDnsXmppChannel::WriteReadyCb, this, msg, _1));
boost::bind(&AgentDnsXmppChannel::WriteReadyCb, this, _1));
}

void AgentDnsXmppChannel::ReceiveMsg(const XmppStanza::XmppMessage *msg) {
Expand Down Expand Up @@ -76,9 +76,7 @@ std::string AgentDnsXmppChannel::ToString() const {
return channel_->ToString();
}

void AgentDnsXmppChannel::WriteReadyCb(uint8_t *msg,
const boost::system::error_code &ec) {
delete [] msg;
void AgentDnsXmppChannel::WriteReadyCb(const boost::system::error_code &ec) {
}

void AgentDnsXmppChannel::XmppClientChannelEvent(AgentDnsXmppChannel *peer,
Expand Down
3 changes: 1 addition & 2 deletions src/vnsw/agent/controller/controller_dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ class AgentDnsXmppChannel {
void RegisterXmppChannel(XmppChannel *channel);

protected:
virtual void WriteReadyCb(uint8_t *msg,
const boost::system::error_code &ec);
virtual void WriteReadyCb(const boost::system::error_code &ec);

private:
void ReceiveInternal(const XmppStanza::XmppMessage *msg);
Expand Down

0 comments on commit 204b64f

Please sign in to comment.