summaryrefslogtreecommitdiff
path: root/TAO/tao/Pluggable_Messaging.cpp
blob: 5a3f79b2411f3f3abd4e3e74e0e1ff7a0bbedd87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//$Id$

#include "tao/Pluggable_Messaging.h"
#include "tao/debug.h"

#if !defined (__ACE_INLINE__)
# include "tao/Pluggable_Messaging.i"
#endif /* __ACE_INLINE__ */



//////////////////////////////////////////////////////////////////////////
// Methods for the Pluugable Messaging stuff
/////////////////////////////////////////////////////////////////////////

TAO_Pluggable_Messaging_Interface::~TAO_Pluggable_Messaging_Interface (void)
{
  //no-op
}

int
TAO_Pluggable_Messaging_Interface::
  transport_message (TAO_Transport *transport,
                     TAO_OutputCDR &stream,
                     int two_way,
                     TAO_Stub *stub,
                     ACE_Time_Value *max_wait_time)
{
  // Strictly speaking, should not need to loop here because the
  // socket never gets set to a nonblocking mode ... some Linux
  // versions seem to need it though.  Leaving it costs little.

  // This guarantees to send all data (bytes) or return an error.
  ssize_t n = transport->send (stub,
                               two_way,
                               stream.begin (),
                               max_wait_time);

  if (n == -1)
    {
      if (TAO_orbdebug)
        ACE_DEBUG ((LM_DEBUG,
                    ASYS_TEXT ("TAO: (%P|%t|%N|%l) closing conn %d after fault %p\n"),
                    transport->handle (),
                    ASYS_TEXT ("transport_message ()\n")));

      return -1;
    }
  
  // EOF.
  if (n == 0)
    {
      if (TAO_orbdebug)
        ACE_DEBUG ((LM_DEBUG,
                    ASYS_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n")
                    ASYS_TEXT ("EOF, closing conn %d\n"),
                    transport->handle()));
      return -1;
    }

  return 1;
}

TAO_Message_State_Factory::~TAO_Message_State_Factory (void)
{
  //no-op
}