Skip to content

Commit

Permalink
Fix ios build (#3200)
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardnormier authored Nov 27, 2024
1 parent b463378 commit 997cc9b
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 28 deletions.
52 changes: 41 additions & 11 deletions cpp/src/Ice/ios/StreamEndpointI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ IceObjC::Instance::communicator()

IceObjC::StreamEndpointI::StreamEndpointI(
const InstancePtr& instance,
const string& ho,
int32_t po,
const string& host,
int32_t port,
const Address& sourceAddr,
int32_t ti,
const string& conId,
bool co)
: IceInternal::IPEndpointI(instance, ho, po, sourceAddr, conId),
int32_t timeout,
const string& connectionId,
bool compress)
: IceInternal::IPEndpointI(instance, host, port, sourceAddr, connectionId),
_streamInstance(instance),
_timeout(ti),
_compress(co)
_timeout(timeout),
_compress(compress)
{
}

Expand Down Expand Up @@ -182,15 +182,22 @@ IceObjC::StreamEndpointI::compress() const
}

EndpointIPtr
IceObjC::StreamEndpointI::compress(bool c) const
IceObjC::StreamEndpointI::compress(bool compress) const
{
if (c == _compress)
if (compress == _compress)
{
return const_cast<StreamEndpointI*>(this)->shared_from_this();
}
else
{
return make_shared<StreamEndpointI>(_streamInstance, _host, _port, _sourceAddr, _timeout, _connectionId, c);
return make_shared<StreamEndpointI>(
_streamInstance,
_host,
_port,
_sourceAddr,
_timeout,
_connectionId,
compress);
}
}

Expand All @@ -206,6 +213,29 @@ IceObjC::StreamEndpointI::secure() const
return _streamInstance->secure();
}

shared_ptr<IceInternal::EndpointI>
IceObjC::StreamEndpointI::toPublishedEndpoint(string publishedHost) const
{
// A server endpoint can't have a source address or connection ID.
assert(!isAddressValid(_sourceAddr) && _connectionId.empty());

if (publishedHost.empty())
{
return const_cast<StreamEndpointI*>(this)->shared_from_this();
}
else
{
return make_shared<StreamEndpointI>(
_streamInstance,
publishedHost,
_port,
_sourceAddr,
_timeout,
_connectionId,
_compress);
}
}

void
IceObjC::StreamEndpointI::connectorsAsync(
Ice::EndpointSelectionType /*selType*/,
Expand Down
16 changes: 9 additions & 7 deletions cpp/src/Ice/ios/StreamEndpointI.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ namespace IceObjC
{
public:
StreamEndpointI(
const InstancePtr&,
const std::string&,
std::int32_t,
const IceInternal::Address&,
std::int32_t,
const std::string&,
bool);
const InstancePtr& instance,
const std::string& host,
std::int32_t port,
const IceInternal::Address& sourceAddr,
std::int32_t timeout,
const std::string& connectionId,
bool compress);
StreamEndpointI(const InstancePtr&);
StreamEndpointI(const InstancePtr&, Ice::InputStream*);

Expand All @@ -85,6 +85,8 @@ namespace IceObjC
bool datagram() const final;
bool secure() const final;

std::shared_ptr<EndpointI> toPublishedEndpoint(std::string publishedHost) const final;

void connectorsAsync(
Ice::EndpointSelectionType,
std::function<void(std::vector<IceInternal::ConnectorPtr>)> response,
Expand Down
4 changes: 2 additions & 2 deletions cpp/src/Ice/ios/StreamTransceiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ IceObjC::StreamTransceiver::getInfo(bool incoming, string adapterName, string co
{
string localAddress;
int localPort;
string remoteAddres;
string remoteAddress;
int remotePort;
fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort);
fdToAddressAndPort(_fd, localAddress, localPort, remoteAddress, remotePort);

return make_shared<TCPConnectionInfo>(
incoming,
Expand Down
6 changes: 3 additions & 3 deletions cpp/src/Ice/ios/iAPEndpointI.mm
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,16 @@ ICEIAP_API void registerIceIAP(bool loadOnInitialize)
}

EndpointIPtr
IceObjC::iAPEndpointI::compress(bool c) const
IceObjC::iAPEndpointI::compress(bool compress) const
{
if (c == _compress)
if (compress == _compress)
{
return const_cast<iAPEndpointI*>(this)->shared_from_this();
}
else
{
return make_shared<
iAPEndpointI>(_instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, _connectionId, c);
iAPEndpointI>(_instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, _connectionId, compress);
}
}

Expand Down
7 changes: 2 additions & 5 deletions cpp/src/Ice/ios/iAPTransceiver.mm
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@

#if TARGET_OS_IPHONE != 0

# include "iAPEndpointI.h"
# include "iAPTransceiver.h"

# include "Ice/ios/iAPConnectionInfo.h"

# include "../ProtocolInstance.h"
# include "Ice/Buffer.h"
# include "Ice/LocalExceptions.h"
# include "iAPEndpointI.h"
# include "iAPTransceiver.h"

# import <Foundation/NSError.h>
# import <Foundation/NSRunLoop.h>
Expand Down

0 comments on commit 997cc9b

Please sign in to comment.