summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp
diff options
context:
space:
mode:
authoryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-02-27 01:42:46 +0000
committeryamuna <yamuna@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2001-02-27 01:42:46 +0000
commit42465e4c5c547f84abc26347aeafcdf4bd0299ba (patch)
treece47f5283e023e2e23aea78296885fc5707aa369 /TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp
parente895628161fddc8b0848779106bee1630adae3f0 (diff)
downloadATCD-42465e4c5c547f84abc26347aeafcdf4bd0299ba.tar.gz
*** empty log message ***
Diffstat (limited to 'TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp')
-rw-r--r--TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp101
1 files changed, 44 insertions, 57 deletions
diff --git a/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp b/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp
index 62393c7eac0..aed2a8eecb6 100644
--- a/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp
+++ b/TAO/orbsvcs/tests/AVStreams/Pluggable/ftp.cpp
@@ -33,7 +33,7 @@ FTP_Client_Callback::get_timeout (ACE_Time_Value *&tv,
{
ACE_Time_Value *timeout;
ACE_NEW (timeout,
- ACE_Time_Value(2));
+ ACE_Time_Value(1));
tv = timeout;
}
@@ -41,69 +41,56 @@ FTP_Client_Callback::get_timeout (ACE_Time_Value *&tv,
int
FTP_Client_Callback::handle_timeout (void *)
{
- //@@coryan: Use a preallocated buffer for benchmarks.
- //Memory map the file.
- count++;
- ACE_Message_Block mb;
- mb.size (message_size);
- mb.wr_ptr (message_size);
- if (count == 10)
- {
- AVStreams::flowSpec stop_spec (1);
- ACE_DECLARE_NEW_CORBA_ENV;
- CLIENT::instance ()->streamctrl ()->stop (stop_spec,ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
- CLIENT::instance ()->streamctrl ()->destroy (stop_spec,ACE_TRY_ENV);
- //TAO_AV_CORE::instance ()->stop_run ();
- TAO_AV_CORE::instance ()->orb ()->shutdown (0);
- return 0;
- }
- ACE_hrtime_t stamp = ACE_OS::gethrtime ();
- // ACE_Message_Block mb (BUFSIZ);
- ACE_OS::memcpy (mb.rd_ptr (), &stamp, sizeof(stamp));
- // ACE_OS::memcpy (this->frame_.rd_ptr (), &stamp, sizeof(stamp));
- ACE_DEBUG ((LM_DEBUG,"FTP_Client_Callback::get_frame"));
- //char *buf = mb.rd_ptr ();
- //cerr << "message block size" << mb.size () << endl;
- // int n = ACE_OS::fread(buf,1,mb.size (),CLIENT::instance ()->file ());
- //int n = ACE_OS::fread(buf,1,mb.size (),stamp);
- /*
- if (n < 0)
- {
- ACE_ERROR_RETURN ((LM_ERROR,"FTP_Client_Flow_Handler::fread end of file\n"),-1);
- }
- if (n == 0)
+
+ ACE_TRY_NEW_ENV
{
- if (::feof (CLIENT::instance ()->file ()))
+ ACE_Message_Block mb (BUFSIZ);
+ char *buf = mb.rd_ptr ();
+
+ int n = ACE_OS::fread(buf,1,mb.size (),CLIENT::instance ()->file ());
+
+ if (n < 0)
+ {
+ ACE_ERROR_RETURN ((LM_ERROR,"FTP_Client_Flow_Handler::fread end of file\n"),-1);
+ }
+ if (n == 0)
{
- // wait for sometime for the data to be flushed to the other side.
- this->count_++;
- if (this->count_ == 2)
+ if (::feof (CLIENT::instance ()->file ()))
{
- //@@coryan: Remove these code from this method.
- //Should be called when the user wants to stop the stream.
- ACE_DEBUG ((LM_DEBUG,"handle_timeout:End of file\n"));
- AVStreams::flowSpec stop_spec (1);
- ACE_DECLARE_NEW_CORBA_ENV;
- CLIENT::instance ()->streamctrl ()->stop (stop_spec,ACE_TRY_ENV);
- ACE_CHECK_RETURN (-1);
- CLIENT::instance ()->streamctrl ()->destroy (stop_spec,ACE_TRY_ENV);
- TAO_AV_CORE::instance ()->stop_run ();
-
+ // wait for sometime for the data to be flushed to the other side.
+ this->count_++;
+ if (this->count_ == 2)
+ {
+ //@@coryan: Remove these code from this method.
+ //Should be called when the user wants to stop the stream.
+ ACE_DEBUG ((LM_DEBUG,"handle_timeout:End of file\n"));
+ AVStreams::flowSpec stop_spec (1);
+ ACE_DECLARE_NEW_CORBA_ENV;
+ CLIENT::instance ()->streamctrl ()->stop (stop_spec,ACE_TRY_ENV);
+ ACE_TRY_CHECK;
+ TAO_AV_CORE::instance ()->orb ()->shutdown (0);
+ ACE_TRY_CHECK;
+ return 0;
+ }
+ else
+ return 0;
}
else
- return 0;
+ return 0;
}
- else
- ACE_ERROR_RETURN ((LM_ERROR,"FTP_Client_Flow_Handler::fread error\n"),-1);
+
+ mb.wr_ptr (n);
+ int result = this->protocol_object_->send_frame (&mb);
+ if (result < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,"send failed:%p","FTP_Client_Flow_Handler::send \n"),-1);
+ ACE_DEBUG ((LM_DEBUG,"handle_timeout::buffer sent succesfully\n"));
+ }
+ ACE_CATCHANY
+ {
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,"FTP_Client_Callback::handle_timeout Failed");
+ return -1;
}
- cerr << "read bytes = " << n << endl;
- */
- //mb.wr_ptr (n);
- int result = this->protocol_object_->send_frame (&mb);
- if (result < 0)
- ACE_ERROR_RETURN ((LM_ERROR,"send failed:%p","FTP_Client_Flow_Handler::send \n"),-1);
- ACE_DEBUG ((LM_DEBUG,"handle_timeout::buffer sent succesfully\n"));
+ ACE_ENDTRY;
return 0;
}