FACT++  1.0
void ConnectionFAD::HandleReceivedData ( const bs::error_code &  error,
size_t  bytes_received,
int   
)
inline

Definition at line 85 of file dclient5.cc.

References buffer, Error(), Connection::HandleReadTimeout(), and str.

86  {
87  // Do not schedule a new read if the connection failed.
88  if (bytes_received==0 || error)
89  {
90  // 107: Transport endpoint is not connected
91  // 125: Operation canceled
92  if (error && error!=ba::error::basic_errors::not_connected)
93  {
94  ostringstream str;
95  str << "Reading from " << URL() << ": " << error.message() << " (" << error << ")";// << endl;
96  Error(str);
97  }
98  PostClose(error!=ba::error::basic_errors::operation_aborted);
99  return;
100  }
101 
102  string txt;
103 
104  if (bytes_received==2)
105  {
106  txt = string(fReadBuffer, bytes_received);
107  //std::vector<char> buf(128);
108  //bytes_transferred = sock.receive(boost::asio::buffer(d3));
109 
110  fMsg() << "Received b=" << bytes_received << ": " << (int)fReadBuffer[0] << " " << (int)txt[0] << " '" << txt << "' " << " " << error.message() << " (" << error << ")" << endl;
111 
112  if (fReadBuffer[0]=='T')
113  {
114  // AsyncRead + Deadline
115  // Do all manipulation to the buffer BEFORE this call!
117  &Connection::HandleReceivedData*/);
119  }
120  else
121  {
122  // AsyncRead + Deadline
123  // Do all manipulation to the buffer BEFORE this call!
125  &Connection::HandleReceivedData*/);
127  }
128  }
129  else
130  {
131  txt = string(fReadBuffer, bytes_received+2);
132  const int s = atoi(fReadBuffer+35);
133  if (s==9)
134  Info("Requested time received: "+txt);
135  else
136  state = s;
137 
138  Out() << "Received b=" << bytes_received << ": " << (int)fReadBuffer[0] << " " << (int)txt[0] << " '" << txt << "' " << " " << error.message() << " (" << error << ")" << endl;
139  memset(fReadBuffer, 0, 100);
140 
141  // Do all manipulation to the buffer BEFORE this call!
142  AsyncRead(ba::buffer(fReadBuffer, 2)/*,
143  &Connection::HandleReceivedData*/);
144 
145 
146  }
147  }
void AsyncWait(boost::asio::deadline_timer &timer, int millisec, void(Connection::*handler)(const boost::system::error_code &))
Definition: Connection.h:75
boost::asio::deadline_timer fInTimeout
Definition: Connection.h:36
void PostClose(bool restart=true)
Definition: Connection.cc:125
char str[80]
Definition: test_client.c:7
MessageImp & fMsg
Definition: dclient5.cc:38
std::ostream & Out()
Definition: Connection.h:51
std::string URL() const
Definition: Connection.h:151
int Error(const std::string &str)
Definition: MessageImp.h:49
void AsyncRead(const boost::asio::mutable_buffers_1 buffers, int type=0)
Definition: Connection.cc:31
int buffer[BUFFSIZE]
Definition: db_dim_client.c:14
char fReadBuffer[1000]
Definition: dclient5.cc:42
virtual void HandleReadTimeout(const boost::system::error_code &)
Definition: Connection.h:138
int Info(const std::string &str)
Definition: MessageImp.h:47
if(extraDns) new Dns
char message[1024]
Definition: db_dim_client.c:16

+ Here is the call graph for this function: