* The KDL command "udp_endpoints" did not work anymore, since

DatagramSocket::AvailableData() locks; introduced a UdpEndpoint::Dump() method
  to work around that.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38355 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2010-08-25 15:51:43 +00:00
parent 124a502a7a
commit cb99c9153b
@@ -101,12 +101,14 @@ public:
UdpEndpoint*& HashTableLink() { return fLink; } UdpEndpoint*& HashTableLink() { return fLink; }
void Dump() const;
private: private:
UdpDomainSupport* fManager; UdpDomainSupport* fManager;
bool fActive; bool fActive;
// an active UdpEndpoint is part of the // an active UdpEndpoint is part of the
// endpoint hash (and it is bound and optionally // endpoint hash (and it is bound and
// connected) // optionally connected)
UdpEndpoint* fLink; UdpEndpoint* fLink;
}; };
@@ -400,15 +402,8 @@ UdpDomainSupport::DumpEndpoints() const
EndpointTable::Iterator it = fActiveEndpoints.GetIterator(); EndpointTable::Iterator it = fActiveEndpoints.GetIterator();
while (it.HasNext()) { while (UdpEndpoint* endpoint = it.Next()) {
UdpEndpoint *endpoint = it.Next(); endpoint->Dump();
char localBuf[64], peerBuf[64];
endpoint->LocalAddress().AsString(localBuf, sizeof(localBuf), true);
endpoint->PeerAddress().AsString(peerBuf, sizeof(peerBuf), true);
kprintf("%p %20s %20s %8lu\n", endpoint, localBuf, peerBuf,
endpoint->AvailableData());
} }
} }
@@ -879,7 +874,11 @@ UdpEndpointManager::_GetDomain(net_buffer* buffer)
UdpEndpoint::UdpEndpoint(net_socket *socket) UdpEndpoint::UdpEndpoint(net_socket *socket)
: DatagramSocket<>("udp endpoint", socket), fActive(false) {} :
DatagramSocket<>("udp endpoint", socket),
fActive(false)
{
}
// #pragma mark - activation // #pragma mark - activation
@@ -1009,7 +1008,7 @@ UdpEndpoint::FetchData(size_t numBytes, uint32 flags, net_buffer **_buffer)
TRACE_EP("FetchData(%ld, 0x%lx)", numBytes, flags); TRACE_EP("FetchData(%ld, 0x%lx)", numBytes, flags);
status_t status = Dequeue(flags, _buffer); status_t status = Dequeue(flags, _buffer);
TRACE_EP(" FetchData(): returned from fifo status=0x%lx", status); TRACE_EP(" FetchData(): returned from fifo status: %s", strerror(status));
if (status != B_OK) if (status != B_OK)
return status; return status;
@@ -1046,6 +1045,18 @@ UdpEndpoint::DeliverData(net_buffer *_buffer)
} }
void
UdpEndpoint::Dump() const
{
char local[64];
LocalAddress().AsString(local, sizeof(local), true);
char peer[64];
PeerAddress().AsString(peer, sizeof(peer), true);
kprintf("%p %20s %20s %8lu\n", this, local, peer, fCurrentBytes);
}
// #pragma mark - protocol interface // #pragma mark - protocol interface