diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2020-12-29 12:52:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-29 12:52:01 +0100 |
commit | fcdef8f553a9e06b05a457f3d93dd5b729d0c84a (patch) | |
tree | 21b7ee9663b619f30a502ab232bb823d0cc0e225 /TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp | |
parent | 67aa234c637d8387bce45604955ec9df74fff185 (diff) | |
parent | daa794e611a517655f168d3bc5db6769a888c8ee (diff) | |
download | ATCD-fcdef8f553a9e06b05a457f3d93dd5b729d0c84a.tar.gz |
Merge pull request #1359 from DOCGroup/repro-fragmentation-issue
Repro problem with fragmented GIOP messages
Diffstat (limited to 'TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp')
-rw-r--r-- | TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp b/TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp new file mode 100644 index 00000000000..04f187eb814 --- /dev/null +++ b/TAO/tests/GIOP_Fragments/Big_String_Sequence/Echo_i.cpp @@ -0,0 +1,79 @@ +#include "Echo_i.h" + +constexpr size_t BIG_LENGTH = 4 * 1024; + +// Constructor. + +Echo_i::Echo_i (CORBA::ORB_ptr o) + : orb_(o) +{ +} + +// Return a list of strings. +Echo::List * +Echo_i::return_list () +{ + Echo::List_var list; + + { + Echo::List *tmp {}; + ACE_NEW_RETURN (tmp, + Echo::List (2), + {}); + list = tmp; + } + + list->length (2); + + // Just do something to get a 'big' list of strings. + CORBA::Char big[BIG_LENGTH + 1]; + for (size_t i = 0; i < BIG_LENGTH; ++i) + big[i] = 'A'; + big[BIG_LENGTH] = 0; + list[CORBA::ULong(0)] = CORBA::string_dup(big); + list[CORBA::ULong(1)] = CORBA::string_dup("Hello World"); + + return list._retn (); +} + +Echo::WList * +Echo_i::return_wlist () +{ + Echo::WList_var list; + + { + Echo::WList *tmp {}; + ACE_NEW_RETURN (tmp, + Echo::WList (2), + {}); + list = tmp; + } + + list->length (2); + + // Just do something to get a 'big' list of wide strings. + CORBA::WChar big[BIG_LENGTH + 1]; + for (size_t i = 0; i < BIG_LENGTH; ++i) + big[i] = 'A'; + big[BIG_LENGTH] = 0; + CORBA::WChar small[17 + 1]; + for (size_t i = 0; i < 17; ++i) + small[i] = 'B'; + small[17] = 0; + list[CORBA::ULong(0)] = CORBA::wstring_dup(big); + list[CORBA::ULong(1)] = CORBA::wstring_dup(small); + + return list._retn (); +} + +// Shutdown the server application. + +void +Echo_i::shutdown () +{ + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("\nThe echo server is shutting down\n"))); + + // Instruct the ORB to shutdown. + this->orb_->shutdown (); +} |