]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/StartListening.cc
2 * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 /* DEBUG: section 54 Interprocess Communication */
12 #include "base/TextException.h"
14 #include "comm/Connection.h"
15 #include "ipc/SharedListen.h"
16 #include "ipc/StartListening.h"
21 Ipc::StartListeningCb::StartListeningCb(): conn(NULL
), errNo(0)
25 Ipc::StartListeningCb::~StartListeningCb()
29 std::ostream
&Ipc::StartListeningCb::startPrint(std::ostream
&os
) const
31 return os
<< "(" << conn
<< ", err=" << errNo
;
35 Ipc::StartListening(int sock_type
, int proto
, const Comm::ConnectionPointer
&listenConn
,
36 FdNoteId fdNote
, AsyncCall::Pointer
&callback
)
38 StartListeningCb
*cbd
= dynamic_cast<StartListeningCb
*>(callback
->getDialer());
40 cbd
->conn
= listenConn
;
42 if (UsingSmp()) { // if SMP is on, share
44 p
.sock_type
= sock_type
;
46 p
.addr
= listenConn
->local
;
47 p
.flags
= listenConn
->flags
;
49 Ipc::JoinSharedListen(p
, callback
);
50 return; // wait for the call back
54 comm_open_listener(sock_type
, proto
, cbd
->conn
, FdNote(fdNote
));
55 cbd
->errNo
= Comm::IsConnOpen(cbd
->conn
) ? 0 : errno
;
58 debugs(54, 3, HERE
<< "opened listen " << cbd
->conn
);
59 ScheduleCallHere(callback
);