This is an archive of the discontinued LLVM Phabricator instance.

Added Connection::GetURI()
AbandonedPublic

Authored by vharron on Jan 16 2015, 5:02 PM.

Details

Reviewers
clayborg
Summary

This function returns a URI of the resource that the connection is connected to. This is especially important for connections established by accepting a connection from a remote host.

Also added implementations for ConnectionMachPort, ConnectionSharedMemory,
Also fixed up some documentation in Connection::Write
Renamed ConnectionFileDescriptorPosix::SocketListen to ConnectionFileDescriptorPosix::SocketListenAndAccept
Fixed a log message in Socket.cpp

Diff Detail

Repository
rL LLVM

Event Timeline

vharron updated this revision to Diff 18329.Jan 16 2015, 5:02 PM
vharron retitled this revision from to Added Connection::GetURI().
vharron updated this object.
vharron edited the test plan for this revision. (Show Details)
vharron added a reviewer: clayborg.
vharron set the repository for this revision to rL LLVM.
vharron added a subscriber: Unknown Object (MLST).
clayborg requested changes to this revision.Jan 16 2015, 5:35 PM
clayborg edited edge metadata.

We can avoid using snprintf and having to try and guess buffer sizes by using StreamString:

so this:

char uri[280]; // sizeof(uri) > strlen("connect://") + 255 + strlen(1) + strlen("65535") + 1
snprintf(uri, sizeof(uri), "connect://%s:%u",socket->GetRemoteIPAddress().c_str(), socket->GetRemotePortNumber());
m_uri.assign(uri);

becomes:

StreamString strm;
strm.Printf("connect://%s:%u",socket->GetRemoteIPAddress().c_str(), socket->GetRemotePortNumber());
m_uri.swap(strm.GetString());

Fix that and you are good to go.

This revision now requires changes to proceed.Jan 16 2015, 5:35 PM

Updated based on comments and submitted

vharron abandoned this revision.Jan 19 2015, 10:32 AM

This is still using snprintf(). Can we switch over to using StringStream?