]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/StartListening.cc
4 * DEBUG: section 54 Interprocess Communication
9 #include "base/TextException.h"
11 #include "ipc/SharedListen.h"
12 #include "ipc/StartListening.h"
15 Ipc::StartListeningCb::StartListeningCb(): fd(-1), errNo(0)
19 Ipc::StartListeningCb::~StartListeningCb()
23 std::ostream
&Ipc::StartListeningCb::startPrint(std::ostream
&os
) const
25 return os
<< "(FD " << fd
<< ", err=" << errNo
;
29 Ipc::StartListening(int sock_type
, int proto
, Ip::Address
&addr
, int flags
,
30 FdNoteId fdNote
, AsyncCall::Pointer
&callback
)
32 if (UsingSmp()) { // if SMP is on, share
34 p
.sock_type
= sock_type
;
39 Ipc::JoinSharedListen(p
, callback
);
40 return; // wait for the call back
43 StartListeningCb
*cbd
= dynamic_cast<StartListeningCb
*>(callback
->getDialer());
47 cbd
->fd
= comm_open_listener(sock_type
, proto
, addr
, flags
, FdNote(fdNote
));
48 cbd
->errNo
= cbd
->fd
>= 0 ? 0 : errno
;
51 debugs(54, 3, HERE
<< "opened listen FD " << cbd
->fd
<< " on " << addr
);
52 ScheduleCallHere(callback
);