Ah sorry, that is because it must be 'inline' if defined in the header,
since this header is likely included in a few compilation units:
inline Try<int> socket(...)
{
...
}
On Wed, Feb 12, 2014 at 12:26 PM, Nikita Vetoshkin <
[email protected]> wrote:
>
>
> > On Feb. 12, 2014, 7:09 p.m., Ben Mahler wrote:
> > > Awesome to see your first patch Nikita! :)
> > >
> > > Have you considered adding a function to socket.hpp to create sockets
> with the appropriate options:
> > >
> > > namespace process {
> > >
> > > Try<int> socket(int family, int type, int protocol)
> > > {
> > > int s;
> > > if ((s = ::socket(family, type, protocol)) == -1) {
> > > return ErrnoError();
> > > }
> > >
> > > #ifdef __APPLE__
> > > // Set SO_NOSIGPIPE.
> > > #endif
> > >
> > > return s;
> > > }
> > >
> > > }
> > >
> > > This seems like a clean short term solution, we can replace all socket
> calls in process.cpp with this. Longer term, we could leverage the Socket
> wrapper further by returning Try<Socket>, but that's probably more work
> than this is worth for now.
>
> That didn't work, linker gone crazy complaining about "multiple definition
> of `process::socket(int, int, int)'" :(
>
>
> - Nikita
>
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/18001/#review34307
> -----------------------------------------------------------
>
>
> On Feb. 12, 2014, 6:49 p.m., Nikita Vetoshkin wrote:
> >
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > https://reviews.apache.org/r/18001/
> > -----------------------------------------------------------
> >
> > (Updated Feb. 12, 2014, 6:49 p.m.)
> >
> >
> > Review request for mesos.
> >
> >
> > Bugs: MESOS-912
> > https://issues.apache.org/jira/browse/MESOS-912
> >
> >
> > Repository: mesos-git
> >
> >
> > Description
> > -------
> >
> > Following the discussion in JIRA - disable SIGPIPE on MacOS via
> setsockopt as it doesn't support MSG_NOSIGNAL.
> >
> >
> > Diffs
> > -----
> >
> > 3rdparty/libprocess/3rdparty/stout/include/stout/os.hpp
> bba6f43eaeba0238a5db6e388902d92eb18f14f5
> > 3rdparty/libprocess/src/config.hpp
> cbaf41d81846c061107e06a8bde197d30f2e469c
> > 3rdparty/libprocess/src/net.hpp
> 2fdc62adc4295a7723da0162a60853bc64c7073c
> > 3rdparty/libprocess/src/process.cpp
> 2e7764a8e0badec704b8610f3f72f0bd16cc9612
> >
> > Diff: https://reviews.apache.org/r/18001/diff/
> >
> >
> > Testing
> > -------
> >
> > None.
> >
> >
> > Thanks,
> >
> > Nikita Vetoshkin
> >
> >
>
>