I have strange behaviour in server program. In simple example it works fine (I insert traces everywhere, in pion and asio).
#include <pion/http/server.hpp>
#include <pion/http/response_writer.hpp>
#include <pion/http/response_reader.hpp>
#include <pion/http/request_writer.hpp>
#include <pion/logger.hpp>
#include <pion/scheduler.hpp>
int main()
{
pion::single_service_scheduler shed;
shed.set_num_threads(1);
boost::shared_ptr<pion::http::server> server
(new pion::http::server(shed, 5000));
server->add_resource("/", handlerFunction);
server->start();
sleep(5);
}
output is like this. Construct socket for acceptor, construct socket for client, tcp connection is created, all works fine.
basic io object constructor
after service construct
basic io object constructor
after service construct
basic io object constructor
Address of socket is: 0x9855fa4 value: -1
after service construct
1422519945 INFO pion.http.server Added request handler for HTTP resource:
1422519945 INFO pion.http.server Starting server on port 5000
before connection create
before connection constructor called
basic io object constructor
basic_stream_socket::construct
Address of socket is: 0x9857514 value: -1
after impl.construct
after service construct
basic io object constructor
after service construct
basic io object constructor
after service construct
ssl socket constructed
connection constructor, is_ssl: 0
after connection create: 0x98574f8
before accept
after accept
In more complicated program with same code, but with oracle and many other libraries output is like this.
basic io object constructor
after service construct
basic io object constructor
after service construct
basic io object constructor
Address of socket is: 0xbfe47a64 value: -1
after service construct
1422525476 INFO pion.http.server Added request handler for HTTP resource:
before connection create
basic io object constructor
after service construct
basic io object constructor
after service construct
after connection create: 0x8fe8b88
before accept
in connection::async_accept
after accept
No second socket created, actually, there is no call of connection::create
, but connection has address as you can see. I have idea, that somewhere something writes on address of function connection::create
(or something like). Can you please help, how can I catch this?