This is an archive of the discontinued LLVM Phabricator instance.

Wrap socket error handling with SetLastError and IsInterrupted internal functions which can properly treat Windows and POSIX errors.
ClosedPublic

Authored by ovyalov on Apr 9 2015, 4:09 PM.

Details

Reviewers
zturner
clayborg
Summary

Populate Error object either with errno or WSAGetLastError() in case of Windows.
We'll still need to fix Error::AsCString to call FormatMessage for Windows errors but at least with this CL we can report about socket errors on Windows with meaningful code and message like "unknown error".

Diff Detail

Event Timeline

ovyalov updated this revision to Diff 23540.Apr 9 2015, 4:09 PM
ovyalov retitled this revision from to Wrap socket error handling with SetLastError and IsInterrupted internal functions which can properly treat Windows and POSIX errors..
ovyalov updated this object.
ovyalov edited the test plan for this revision. (Show Details)
ovyalov added reviewers: zturner, clayborg.
ovyalov added a subscriber: Unknown Object (MLST).
clayborg accepted this revision.Apr 9 2015, 4:11 PM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Apr 9 2015, 4:11 PM
zturner accepted this revision.Apr 9 2015, 4:18 PM
zturner edited edge metadata.

Looks ok. I'm wondering at what point we should break the Socket class up into a SocketWindows and SocketPosix variants. Seems like soon, the number of ifdefs keeps growing. Not suggesting you should do this now though, just thinking out loud.

source/Host/common/Socket.cpp
598

Indentation is messed up here.

640

Messed up here too.

Looks ok. I'm wondering at what point we should break the Socket class up into a SocketWindows and SocketPosix variants. Seems like soon, the number of ifdefs keeps growing. Not suggesting you should do this now though, just thinking out loud.

Agree - we'll need to do this soon.

source/Host/common/Socket.cpp
598

Fixed.

640

Fixed.

ovyalov updated this revision to Diff 23544.Apr 9 2015, 4:25 PM
ovyalov edited edge metadata.

Fixed indentation.

ovyalov closed this revision.Apr 9 2015, 7:35 PM

AFFECTED FILES

/lldb/trunk/source/Host/common/Socket.cpp

USERS

ovyalov (Author)

http://reviews.llvm.org/rL234559