#include <UPIPE_Acceptor.h>
Inheritance diagram for ACE_UPIPE_Acceptor:


Public Methods | |
| ACE_UPIPE_Acceptor (void) | |
| Default constructor. More... | |
| ACE_UPIPE_Acceptor (const ACE_UPIPE_Addr &local_sap, int reuse_addr=0) | |
| Initialize passive endpoint. More... | |
| int | open (const ACE_UPIPE_Addr &local_sap, int reuse_addr=0) |
| Initialize passive endpoint. More... | |
| ~ACE_UPIPE_Acceptor (void) | |
| Close down and release resources. More... | |
| int | close (void) |
| Close down and release resources. More... | |
| int | remove (void) |
| Close down and release resources and remove the underlying SPIPE rendezvous point. More... | |
| int | accept (ACE_UPIPE_Stream &server_stream, ACE_UPIPE_Addr *remote_addr=0, ACE_Time_Value *timeout=0, int restart=1, int reset_new_handle=0) |
| void | dump (void) const |
| Dump the state of an object. More... | |
Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. More... | |
Private Attributes | |
| ACE_Thread_Manager | tm |
| Manage threads. More... | |
| ACE_Message_Block | mb_ |
| To confirm connection establishment. More... | |
Definition at line 37 of file UPIPE_Acceptor.h.
|
|
Default constructor.
Definition at line 25 of file UPIPE_Acceptor.cpp. References ACE_TRACE.
00026 : mb_ (sizeof (ACE_UPIPE_Stream *)) 00027 { 00028 ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); 00029 } |
|
||||||||||||
|
Initialize passive endpoint.
Definition at line 55 of file UPIPE_Acceptor.cpp. References ACE_ERROR, ACE_LIB_TEXT, ACE_TRACE, LM_ERROR, and open.
00057 : mb_ (sizeof (ACE_UPIPE_Stream *)) 00058 { 00059 ACE_TRACE ("ACE_UPIPE_Acceptor::ACE_UPIPE_Acceptor"); 00060 00061 if (this->open (local_addr, reuse_addr) == -1) 00062 ACE_ERROR ((LM_ERROR, 00063 ACE_LIB_TEXT ("%p\n"), 00064 ACE_LIB_TEXT ("ACE_UPIPE_Acceptor"))); 00065 } |
|
|
Close down and release resources.
Definition at line 31 of file UPIPE_Acceptor.cpp. References ACE_TRACE.
00032 {
00033 ACE_TRACE ("ACE_UPIPE_Acceptor::~ACE_UPIPE_Acceptor");
00034 }
|
|
||||||||||||||||||||||||
|
Accept a new data transfer connection. A timeout of 0 means block forever, a timeout of {0, 0} means poll. restart == 1 means "restart if interrupted." Definition at line 68 of file UPIPE_Acceptor.cpp. References ACE_SPIPE_Acceptor::accept, ACE_ERROR, ACE_GUARD_RETURN, ACE_LIB_TEXT, ACE_MT, ACE_TRACE, ACE_UPIPE_Stream::get_handle, ACE_IPC_SAP::get_handle, ACE_SPIPE::get_local_addr, ACE_SPIPE_Stream::get_remote_addr, ACE_Stream< ACE_SYNCH >::link, LM_ERROR, ACE_SPIPE::local_addr_, mb_, ACE_OS::read, ACE_UPIPE_Stream::reference_count_, ACE_UPIPE_Stream::remote_addr_, ACE_UPIPE_Stream::send, ACE_IPC_SAP::set_handle, and ACE_UPIPE_Stream::stream_.
00073 {
00074 ACE_TRACE ("ACE_UPIPE_Acceptor::accept");
00075 ACE_UNUSED_ARG (reset_new_handle);
00076
00077 ACE_SPIPE_Stream new_io;
00078
00079 if (this->ACE_SPIPE_Acceptor::accept (new_io, remote_addr,
00080 timeout, restart) == -1)
00081 return -1;
00082 else
00083 {
00084 ACE_UPIPE_Stream *remote_stream = 0;
00085
00086 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, new_stream.lock_, -1));
00087
00088 new_stream.set_handle (new_io.get_handle ());
00089 new_stream.reference_count_++;
00090
00091 // Transfer address ownership.
00092 new_io.get_local_addr (new_stream.local_addr_);
00093 new_io.get_remote_addr (new_stream.remote_addr_);
00094
00095 // Now that we got the handle, we'll read the address of the
00096 // connector-side ACE_UPIPE_Stream out of the pipe and link that
00097 // ACE_UPIPE_Stream to our ACE_UPIPE_Stream.
00098
00099 if (ACE_OS::read (new_stream.get_handle (),
00100 (char *) &remote_stream,
00101 sizeof remote_stream) == -1)
00102 ACE_ERROR ((LM_ERROR,
00103 ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"),
00104 ACE_LIB_TEXT ("read stream address failed")));
00105 else if (new_stream.stream_.link (remote_stream->stream_) == -1)
00106 ACE_ERROR ((LM_ERROR,
00107 ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"),
00108 ACE_LIB_TEXT ("link streams failed")));
00109 // Send a message over the new streampipe to confirm acceptance.
00110 else if (new_stream.send (&mb_, 0) == -1)
00111 ACE_ERROR ((LM_ERROR,
00112 ACE_LIB_TEXT ("ACE_UPIPE_Acceptor: %p\n"),
00113 ACE_LIB_TEXT ("linked stream.put failed")));
00114
00115 // Close down the new_stream at this point in order to conserve
00116 // handles. Note that we don't need the SPIPE connection
00117 // anymore since we're now linked via the <Message_Queue>.
00118 new_stream.ACE_SPIPE::close ();
00119 return 0;
00120 }
00121 }
|
|
|
Close down and release resources.
Reimplemented from ACE_SPIPE_Acceptor. Definition at line 47 of file UPIPE_Acceptor.cpp. References ACE_TRACE, and ACE_SPIPE_Acceptor::close.
00048 {
00049 ACE_TRACE ("ACE_UPIPE_Acceptor::close");
00050 return this->ACE_SPIPE_Acceptor::close ();
00051 }
|
|
|
Dump the state of an object.
Reimplemented from ACE_SPIPE_Acceptor. Definition at line 18 of file UPIPE_Acceptor.cpp. References ACE_TRACE.
00019 {
00020 ACE_TRACE ("ACE_UPIPE_Acceptor::dump");
00021 }
|
|
||||||||||||
|
Initialize passive endpoint.
Definition at line 39 of file UPIPE_Acceptor.cpp. References ACE_TRACE, and ACE_SPIPE_Acceptor::open. Referenced by ACE_UPIPE_Acceptor.
00041 {
00042 ACE_TRACE ("ACE_UPIPE_Acceptor::open");
00043 return this->ACE_SPIPE_Acceptor::open (local_addr, reuse_addr);
00044 }
|
|
|
Close down and release resources and remove the underlying SPIPE rendezvous point.
Reimplemented from ACE_SPIPE_Acceptor. Definition at line 7 of file UPIPE_Acceptor.i. References ACE_TRACE, and ACE_SPIPE_Acceptor::remove.
00008 {
00009 ACE_TRACE ("ACE_UPIPE_Acceptor::remove");
00010 return this->ACE_SPIPE_Acceptor::remove ();
00011 }
|
|
|
Declare the dynamic allocation hooks.
Reimplemented from ACE_SPIPE_Acceptor. Definition at line 78 of file UPIPE_Acceptor.h. |
|
|
To confirm connection establishment.
Definition at line 85 of file UPIPE_Acceptor.h. Referenced by accept. |
|
|
Manage threads.
Definition at line 82 of file UPIPE_Acceptor.h. |
1.2.14 written by Dimitri van Heesch,
© 1997-2002