FACT++  1.0
void ConnectionInterlock::HandleRead ( const boost::system::error_code &  err,
size_t  bytes_received 
)
inlineprivate

Definition at line 108 of file pwrctrl.cc.

References Error(), and str.

Referenced by StartReadReport().

109  {
110  // Do not schedule a new read if the connection failed.
111  if (bytes_received==0 || err)
112  {
113  if (err==ba::error::eof)
114  {
115  if (!fRdfData.empty())
116  ProcessAnswer();
117  return;
118  }
119 
120  // 107: Transport endpoint is not connected (bs::error_code(107, bs::system_category))
121  // 125: Operation canceled
122  if (err && err!=ba::error::eof && // Connection closed by remote host
123  err!=ba::error::basic_errors::not_connected && // Connection closed by remote host
124  err!=ba::error::basic_errors::operation_aborted) // Connection closed by us
125  {
126  ostringstream str;
127  str << "Reading from " << URL() << ": " << err.message() << " (" << err << ")";// << endl;
128  Error(str);
129  }
130  PostClose(err!=ba::error::basic_errors::operation_aborted);
131 
132  fRdfData = "";
133  return;
134  }
135 
136  fRdfData += string(fArray.data(), bytes_received);
137 
138  // Does the message contain a header?
139  const size_t p1 = fRdfData.find("\r\n\r\n");
140  if (p1!=string::npos)
141  {
142  // Does the answer also contain the body?
143  const size_t p2 = fRdfData.find("\r\n\r\n", p1+4);
144  if (p2!=string::npos)
145  ProcessAnswer();
146  }
147 
148  // Go on reading until the web-server closes the connection
149  StartReadReport();
150  }
char str[80]
Definition: test_client.c:7
void StartReadReport()
Definition: pwrctrl.cc:154
void ProcessAnswer()
Definition: pwrctrl.cc:54
Error()
Definition: HeadersFTM.h:197
boost::array< char, 4096 > fArray
Definition: pwrctrl.cc:41

+ Here is the call graph for this function:

+ Here is the caller graph for this function: