summaryrefslogtreecommitdiff
path: root/apps/JAWS/server/PROTOTYPE/JAWS/IO_Handler.cpp
blob: 52922842dcecbf24defbedf1fffafd23a047c416 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// $Id$

#include "JAWS/IO.h"
#include "JAWS/IO_Handler.h"

JAWS_IO_Handler_Factory::~JAWS_IO_Handler_Factory (void)
{
}

JAWS_Synch_IO_Handler::JAWS_Synch_IO_Handler (JAWS_IO *io,
                                              JAWS_IO_Handler_Factory *factory)
  : state_ (0),
    io_ (io),
    pipeline_ (0),
    factory_ (factory)
{
  this->io_.handler (this);
}

JAWS_Synch_IO_Handler::~JAWS_Synch_IO_Handler (void)
{
  if (this->state_)
    this->state_->release ();
  this->state_ = 0;
}

void
JAWS_Synch_IO_Handler::accept_complete (void)
{
  // callback into pipeline task, notify that the accept has completed
}

void
JAWS_Synch_IO_Handler::accept_error (void)
{
  // callback into pipeline task, notify that the accept has failed
}

void
JAWS_Synch_IO_Handler::read_complete (ACE_Message_Block &data)
{
  // We can call back into the pipeline task at this point
  this->pipeline_->read_complete (data);
}

void
JAWS_Synch_IO_Handler::read_error (void)
{
  this->pipeline_->read_error ();
}

void
JAWS_Synch_IO_Handler::transmit_file_complete (void)
{
  this->pipeline_->transmit_file_complete ();
}

void
JAWS_Synch_IO_Handler::transmit_file_error (int result)
{
  this->pipeline_->transmit_file_complete (result);
}

void
JAWS_Synch_IO_Handler::receive_file_complete (void)
{
}

void
JAWS_Synch_IO_Handler::receive_file_error (int result)
{
  ACE_UNUSED_ARG(result);
}

void
JAWS_Synch_IO_Handler::write_error (void)
{
  ACE_DEBUG ((LM_DEBUG, " (%t) %s error in writing response\n",
              request_.uri ()));

  this->done ();
}

void
JAWS_Synch_IO_Handler::confirmation_message_complete (void)
{
}

void
JAWS_Synch_IO_Handler::error_message_complete (void)
{
}

JAWS_IO_Handler_Factory *
JAWS_Synch_IO_Handler::factory (void)
{
  return this->factory_;
}

void
JAWS_Synch_IO_Handler::done (void)
{
  this->factory()->destroy_http_handler (this, this->io_);
}

JAWS_IO_Handler *
JAWS_Synch_IO_Handler_Factory::create_io_handler (void)
{
  JAWS_Synch_IO *io;
  JAWS_Synch_IO_Handler *handler;

  io = new JAWS_Synch_IO;
  if (io == 0) return 0;

  handler = new JAWS_Synch_IO_Handler (io, this);
  if (handler == 0) destroy_io_handler (0, io);

  return handler;
}

void
JAWS_Synch_IO_Handler_Factory::destroy_io_handler (JAWS_IO_Handler *handler,
                                                   JAWS_IO *io)
{
  delete handler;
  delete io;
}