=== modified file 'src/ipc/Coordinator.cc' --- src/ipc/Coordinator.cc 2011-06-18 00:12:51 +0000 +++ src/ipc/Coordinator.cc 2011-07-15 14:07:47 +0000 @@ -128,7 +128,7 @@ request.params.addr << " to kid" << request.requestorId << " mapId=" << request.mapId); - SharedListenResponse response(c, errNo, request.mapId); + SharedListenResponse response(c->fd, errNo, request.mapId); TypedMsgHdr message; response.pack(message); SendMessage(MakeAddr(strandAddrPfx, request.requestorId), message); === modified file 'src/ipc/SharedListen.cc' --- src/ipc/SharedListen.cc 2011-05-13 08:13:01 +0000 +++ src/ipc/SharedListen.cc 2011-07-19 16:15:23 +0000 @@ -82,18 +82,17 @@ } -Ipc::SharedListenResponse::SharedListenResponse(const Comm::ConnectionPointer &c, int anErrNo, int aMapId): - conn(c), errNo(anErrNo), mapId(aMapId) +Ipc::SharedListenResponse::SharedListenResponse(int aFd, int anErrNo, int aMapId): + fd(aFd), errNo(anErrNo), mapId(aMapId) { } Ipc::SharedListenResponse::SharedListenResponse(const TypedMsgHdr &hdrMsg): - conn(NULL), errNo(0), mapId(-1) + fd(-1), errNo(0), mapId(-1) { hdrMsg.checkType(mtSharedListenResponse); hdrMsg.getPod(*this); - conn = new Comm::Connection; - conn->fd = hdrMsg.getFd(); + fd = hdrMsg.getFd(); // other conn details are passed in OpenListenerParams and filled out by SharedListenJoin() } @@ -101,7 +100,7 @@ { hdrMsg.setType(mtSharedListenResponse); hdrMsg.putPod(*this); - hdrMsg.putFd(conn->fd); + hdrMsg.putFd(fd); } @@ -127,10 +126,8 @@ void Ipc::SharedListenJoined(const SharedListenResponse &response) { - Comm::ConnectionPointer c = response.conn; - // Dont debugs c fully since only FD is filled right now. - debugs(54, 3, HERE << "got listening FD " << c->fd << " errNo=" << + debugs(54, 3, HERE << "got listening FD " << response.fd << " errNo=" << response.errNo << " mapId=" << response.mapId); Must(TheSharedListenRequestMap.find(response.mapId) != TheSharedListenRequestMap.end()); @@ -138,22 +135,24 @@ Must(por.callback != NULL); TheSharedListenRequestMap.erase(response.mapId); - if (Comm::IsConnOpen(c)) { + StartListeningCb *cbd = dynamic_cast(por.callback->getDialer()); + assert(cbd && cbd->conn != NULL); + Must(cbd && cbd->conn != NULL); + cbd->conn->fd = response.fd; + + if (Comm::IsConnOpen(cbd->conn)) { OpenListenerParams &p = por.params; - c->local = p.addr; - c->flags = p.flags; + cbd->conn->local = p.addr; + cbd->conn->flags = p.flags; // XXX: leave the comm AI stuff to comm_import_opened()? struct addrinfo *AI = NULL; p.addr.GetAddrInfo(AI); AI->ai_socktype = p.sock_type; AI->ai_protocol = p.proto; - comm_import_opened(c, FdNote(p.fdNote), AI); + comm_import_opened(cbd->conn, FdNote(p.fdNote), AI); p.addr.FreeAddrInfo(AI); } - StartListeningCb *cbd = dynamic_cast(por.callback->getDialer()); - Must(cbd); - cbd->conn = c; cbd->errNo = response.errNo; cbd->handlerSubscription = por.params.handlerSubscription; ScheduleCallHere(por.callback); === modified file 'src/ipc/SharedListen.h' --- src/ipc/SharedListen.h 2010-11-26 09:57:06 +0000 +++ src/ipc/SharedListen.h 2011-07-15 14:04:24 +0000 @@ -60,12 +60,12 @@ class SharedListenResponse { public: - SharedListenResponse(const Comm::ConnectionPointer &c, int errNo, int mapId); + SharedListenResponse(int fd, int errNo, int mapId); explicit SharedListenResponse(const TypedMsgHdr &hdrMsg); ///< from recvmsg() void pack(TypedMsgHdr &hdrMsg) const; ///< prepare for sendmsg() public: - Comm::ConnectionPointer conn; ///< opened listening socket or -1 + int fd; ///< opened listening socket or -1 int errNo; ///< errno value from comm_open_sharedListen() call int mapId; ///< to map future response to the requestor's callback }; === modified file 'src/ipc/StartListening.cc' --- src/ipc/StartListening.cc 2011-01-31 11:50:28 +0000 +++ src/ipc/StartListening.cc 2011-07-19 16:16:19 +0000 @@ -30,6 +30,10 @@ Ipc::StartListening(int sock_type, int proto, const Comm::ConnectionPointer &listenConn, FdNoteId fdNote, AsyncCall::Pointer &callback) { + StartListeningCb *cbd = dynamic_cast(callback->getDialer()); + Must(cbd); + cbd->conn = listenConn; + if (UsingSmp()) { // if SMP is on, share OpenListenerParams p; p.sock_type = sock_type; @@ -41,10 +45,6 @@ return; // wait for the call back } - StartListeningCb *cbd = dynamic_cast(callback->getDialer()); - Must(cbd); - cbd->conn = listenConn; - enter_suid(); comm_open_listener(sock_type, proto, cbd->conn, FdNote(fdNote)); cbd->errNo = Comm::IsConnOpen(cbd->conn) ? 0 : errno;