Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
cesar-douady committed May 3, 2024
1 parent 1a94c9c commit 584a0e0
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
6 changes: 4 additions & 2 deletions src/autodep/gather.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,11 @@ void Gather::_send_to_server ( Fd fd , Jerr&& jerr ) {
case Proc::ChkDeps : reorder(false/*at_end*/) ; break ; // ensure server sees a coherent view
case Proc::DepVerbose : _new_accesses(fd,::copy(jerr)) ; break ;
//
case Proc::Decode : SWEAR(jerr.files.size()==1) ; _codec_files[fd] = Codec::mk_decode_node( jerr.files[0].first , jerr.ctx , jerr.txt ) ; break ;
case Proc::Encode : SWEAR(jerr.files.size()==1) ; _codec_files[fd] = Codec::mk_encode_node( jerr.files[0].first , jerr.ctx , jerr.txt ) ; break ;
case Proc::Decode : SWEAR( jerr.sync && jerr.files.size()==1 ) ; _codec_files[fd] = Codec::mk_decode_node( jerr.files[0].first , jerr.ctx , jerr.txt ) ; break ;
case Proc::Encode : SWEAR( jerr.sync && jerr.files.size()==1 ) ; _codec_files[fd] = Codec::mk_encode_node( jerr.files[0].first , jerr.ctx , jerr.txt ) ; break ;
default : ;
}
if (!jerr.sync) fd = {} ; // dont reply if not sync
try {
JobMngtRpcReq jmrr ;
if (jerr.proc==JobExecProc::ChkDeps) jmrr = { JobMngtProc::ChkDeps , seq_id , job , fd , cur_deps_cb() } ;
Expand Down Expand Up @@ -451,6 +452,7 @@ Status Gather::exec_child( ::vector_s const& args , Fd cstdin , Fd cstdout , Fd
case JobMngtProc::ChkDeps : if (jmrr.ok==Maybe) { set_status(Status::ChkDeps) ; kill_step = KillStep::Kill ; rfd = {} ; } break ;
case JobMngtProc::Decode :
case JobMngtProc::Encode : {
SWEAR(+jmrr.fd) ;
auto it = _codec_files.find(jmrr.fd) ;
_new_access( rfd , PD(New) , ::move(it->second) , {.accesses=Access::Reg} , jmrr.crc , false/*parallel*/ , ::string(snake(jmrr.proc)) ) ;
_codec_files.erase(it) ;
Expand Down
6 changes: 2 additions & 4 deletions src/lmakeserver/codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,8 @@ namespace Codec {
case JobMngtProc::Decode : jmrr = cc.decode() ; break ;
case JobMngtProc::Encode : jmrr = cc.encode() ; break ;
DF}
if (cc.fd) {
jmrr.fd = cc.fd ; // seq_id will be filled in by send_reply
Backends::send_reply( cc.job , ::move(jmrr) ) ;
}
jmrr.fd = cc.fd ; // seq_id will be filled in by send_reply
Backends::send_reply( cc.job , ::move(jmrr) ) ;
}

}
10 changes: 4 additions & 6 deletions src/lmakeserver/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -376,12 +376,10 @@ bool/*interrupted*/ engine_loop() {
::vector<Dep> deps ; deps.reserve(ecjm.deps.size()) ;
for( auto const& [dn,dd] : ecjm.deps ) deps.emplace_back(Node(dn),dd) ;
JobMngtRpcReply jmrr = je.job_info(ecjm.proc,deps) ;
if (+ecjm.fd) {
jmrr.fd = ecjm.fd ; // seq_id will be filled in by send_reply
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Backends::send_reply( +je , ::move(jmrr) ) ;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
jmrr.fd = ecjm.fd ; // seq_id will be filled in by send_reply
//vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
Backends::send_reply( +je , ::move(jmrr) ) ;
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
} break ;
DF}
} break ;
Expand Down
3 changes: 2 additions & 1 deletion src/rpc_job.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ ::ostream& operator<<( ::ostream& os , JobMngtRpcReq const& jmrr ) {
return os <<')' ;
}

JobMngtRpcReq::JobMngtRpcReq( SI si , JI j , Fd fd_ , JobExecRpcReq&& jerr ) : seq_id{si} , job{j} , fd{jerr.sync?fd_:Fd()} {
JobMngtRpcReq::JobMngtRpcReq( SI si , JI j , Fd fd_ , JobExecRpcReq&& jerr ) : seq_id{si} , job{j} , fd{fd_} {
SWEAR( jerr.sync || !fd , jerr,fd ) ;
switch (jerr.proc) {
case JobExecProc::Decode : proc = P::Decode ; ctx = ::move(jerr.ctx) ; file = ::move(jerr.files[0].first) ; txt = ::move(jerr.txt) ; break ;
case JobExecProc::Encode : proc = P::Encode ; ctx = ::move(jerr.ctx) ; file = ::move(jerr.files[0].first) ; txt = ::move(jerr.txt) ; min_len = jerr.min_len ; break ;
Expand Down

0 comments on commit 584a0e0

Please sign in to comment.