Skip to content

Commit

Permalink
Merge pull request #170 from Quicr/tievens-0604
Browse files Browse the repository at this point in the history
Add reliable flag to server publish object cb
  • Loading branch information
TimEvens committed Jun 4, 2024
2 parents f6b6da7 + 3ffdbf9 commit 79599e5
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions cmd/really/really.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class ReallyServerDelegate : public quicr::ServerDelegate

void onPublisherObject(const qtransport::TransportConnId& conn_id,
[[maybe_unused]] const qtransport::DataContextId& data_ctx_id,
[[maybe_unused]] bool reliable,
quicr::messages::PublishDatagram&& datagram) override
{
const auto list = subscribeList.find(datagram.header.name);
Expand Down
2 changes: 1 addition & 1 deletion dependencies/transport
3 changes: 3 additions & 0 deletions include/quicr/quicr_server_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class ServerDelegate
*
* @param conn_id : Context id the message was received on
* @param data_ctx_id : Stream ID the message was received on
* @param reliable : Indicates if object was received using
* reliable transport
* @param datagram : QuicR Published Message Datagram
*
* @note: It is important that the implementations not perform
Expand All @@ -87,6 +89,7 @@ class ServerDelegate
*/
virtual void onPublisherObject(const qtransport::TransportConnId& conn_id,
const qtransport::DataContextId& data_ctx_id,
bool reliable,
messages::PublishDatagram&& datagram) = 0;

/**
Expand Down
3 changes: 2 additions & 1 deletion src/quicr_server_raw_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ ServerRawSession::handle_publish(qtransport::TransportConnId conn_id,
#endif
}

delegate->onPublisherObject(conn_id, *data_ctx_id, std::move(datagram));
// NOTE: if stream_id is nullopt, it means it's not reliable and MUST be datagram
delegate->onPublisherObject(conn_id, *data_ctx_id, stream_id.has_value(), std::move(datagram));
}

void
Expand Down
4 changes: 4 additions & 0 deletions test/fake_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ struct FakeTransport : public ITransport
[[maybe_unused]] DataContextId data_ctx_id,
[[maybe_unused]] uint64_t stream_id) override {}

void setDataCtxPriority([[maybe_unused]] const TransportConnId conn_id,
[[maybe_unused]] DataContextId data_ctx_id,
[[maybe_unused]] uint8_t priority) override {}

std::shared_ptr<StreamBuffer<uint8_t>> getStreamBuffer(TransportConnId, uint64_t) override { return nullptr;}
void close(const TransportConnId& /* conn_id */) override {};

Expand Down
1 change: 1 addition & 0 deletions test/quicr_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class TestServerDelegate : public ServerDelegate

void onPublisherObject([[maybe_unused]] const qtransport::TransportConnId& conn_id,
[[maybe_unused]] const qtransport::DataContextId& data_ctx_id,
[[maybe_unused]] bool reliable,
[[maybe_unused]] messages::PublishDatagram&& datagram) override
{
}
Expand Down

0 comments on commit 79599e5

Please sign in to comment.