Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program terminated with signal SIGABRT, Aborted.
- #0 0x00007f9ed30ee107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
- 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
- (gdb) bt
- #0 0x00007f9ed30ee107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
- #1 0x00007f9ed30ef4e8 in __GI_abort () at abort.c:89
- #2 0x00007f9ed312c044 in __libc_message (do_abort=do_abort@entry=1,
- fmt=fmt@entry=0x7f9ed321ec60 "*** Error in `%s': %s: 0x%s ***n") at ../sysdeps/posix/libc_fatal.c:175
- #3 0x00007f9ed313181e in malloc_printerr (action=1, str=0x7f9ed321f000 "malloc(): memory corruption (fast)",
- ptr=<optimized out>) at malloc.c:4996
- #4 0x00007f9ed3133bbb in _int_malloc (av=0x7f9ecc000020, bytes=32) at malloc.c:3359
- #5 0x00007f9ed3134eb0 in __GI___libc_malloc (bytes=32) at malloc.c:2891
- #6 0x00007f9ed39d82e8 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
- #7 0x0000000000471058 in Poco::Net::ParallelSocketAcceptor<BFSTcpServiceHandler, Poco::Net::SocketReactor>::createServiceHandler (this=0x7f9ed0e17d70, socket=...) at /usr/local/include/Poco/Net/ParallelSocketAcceptor.h:172
- #8 0x00000000004709d2 in Poco::Net::ParallelSocketAcceptor<BFSTcpServiceHandler, Poco::Net::SocketReactor>::onAccept
- (this=0x7f9ed0e17d70, pNotification=0x7f9ecc0009c0) at /usr/local/include/Poco/Net/ParallelSocketAcceptor.h:160
- #9 0x0000000000472bfe in Poco::Observer<Poco::Net::ParallelSocketAcceptor<BFSTcpServiceHandler, Poco::Net::SocketReactor>, Poco::Net::ReadableNotification>::notify (this=0x7f9ecc001d20, pNf=0x7f9ecc0009c0)
- at /usr/local/include/Poco/Observer.h:86
- #10 0x00007f9ed4709c4b in Poco::NotificationCenter::postNotification(Poco::AutoPtr<Poco::Notification>) ()
- from /usr/local/lib/libPocoFoundation.so.30
- #11 0x00007f9ed43c6630 in Poco::Net::SocketNotifier::dispatch(Poco::Net::SocketNotification*) ()
- from /usr/local/lib/libPocoNet.so.30
- #12 0x00007f9ed43c38a4 in Poco::Net::SocketReactor::dispatch(Poco::AutoPtr<Poco::Net::SocketNotifier>&, Poco::Net::SocketNotification*) () from /usr/local/lib/libPocoNet.so.30
- #13 0x00007f9ed43c3d1b in Poco::Net::SocketReactor::dispatch(Poco::Net::Socket const&, Poco::Net::SocketNotification*)
- () from /usr/local/lib/libPocoNet.so.30
- #14 0x00007f9ed43c4910 in Poco::Net::SocketReactor::run() () from /usr/local/lib/libPocoNet.so.30
- #15 0x000000000046a8dc in BFSTcpServer::run () at src/BFSTcpServer.cpp:69
- #16 0x0000000000459c1b in std::_Bind_simple<void (*())()>::_M_invoke<>(std::_Index_tuple<>) (this=0x1ee8d38)
- at /usr/include/c++/4.9/functional:1700
- ---Type <return> to continue, or q <return> to quit---
- #17 0x0000000000459b63 in std::_Bind_simple<void (*())()>::operator()() (this=0x1ee8d38)
- at /usr/include/c++/4.9/functional:1688
- #18 0x0000000000459ae0 in std::thread::_Impl<std::_Bind_simple<void (*())()> >::_M_run() (this=0x1ee8d20)
- at /usr/include/c++/4.9/thread:115
- #19 0x00007f9ed3a2f970 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
- #20 0x00007f9ed4eaa0a4 in start_thread (arg=0x7f9ed0e18700) at pthread_create.c:309
- #21 0x00007f9ed319eccd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
- ...
- ServerSocket serverSocket(port);
- reactor = new SocketReactor();
- ParallelSocketAcceptor<BFSTcpServiceHandler,SocketReactor> acceptor(serverSocket, *reactor);
- reactor->run();
- ...
- class BFSTcpServiceHandler {
- Poco::Net::StreamSocket socket;
- Poco::Net::SocketReactor& reactor;
- ...
- void onReadable(const Poco::AutoPtr<Poco::Net::ReadableNotification>& pNf);
- ...
- public:
- BFSTcpServiceHandler(Poco::Net::StreamSocket& _socket,
- Poco::Net::SocketReactor& _reactor);
- virtual ~BFSTcpServiceHandler();
- };
- //And implementation:
- BFSTcpServiceHandler::BFSTcpServiceHandler(StreamSocket& _socket,
- SocketReactor& _reactor): socket(_socket),reactor(_reactor) {
- //Register Callbacks
- reactor.addEventHandler(socket, NObserver<BFSTcpServiceHandler,
- ReadableNotification>(*this, &BFSTcpServiceHandler::onReadable));
- }
- BFSTcpServiceHandler::~BFSTcpServiceHandler() {
- //Unregister Callbacks
- reactor.removeEventHandler(socket, NObserver<BFSTcpServiceHandler,
- ReadableNotification>(*this, &BFSTcpServiceHandler::onReadable));
- //Close socket
- try {
- socket.shutdown();
- socket.close();
- }catch(Exception &e){
- LOG(ERROR)<<"ERROR IN CLOSING CONNECTION";
- }
- }
- void BFSTcpServiceHandler::onReadable(
- const Poco::AutoPtr<Poco::Net::ReadableNotification>& pNf) {
- ...
- int read = socket.receiveBytes(_packet,sizeof(reqPacket.opCode));
- ...
- //connection is served just close it!
- delete this;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement