Amazing that it actually runs! I had imagined the biggest problem with the porting would have been the sockets. Perl on Windows possibly doesn't implement all socket features, like maybe nonblocking mode, or the can_read function of IO::Select. Look in the rpc_server_alt function that handles all client connections. There is a big while loop which iterates over all connected clients, reads any request data available up to that point, and then sends response data when sufficient request data (such as basic authentication) has been obtained. Trace the execution of this loop to see what runs normally and at what exact point the execution gets stuck.
So I've gone through the rpc_server_alt function and it doesn't appear to be hanging anywhere, the loop runs normally whether the worker is connected or not. But what I did find that seemed odd, was the it moves into code that appears to process the getwork request *as the worker disconnects*. Here's a short section of code I'm referring too. (Can't give line numbers as the unix2dos converter added a ton of whitespace, in theory it's after line 1400)
} else {
if ($vars->{longpoll}){
$vars->{rec}=2;
last;
}
$user->{getworks}++;
my $user_ip=$user->{host}; $user_ip=~s/:.*//;
my $limiter=$user_limiter{$user_ip};
my $lawful=user_lawful($limiter);
my $pair;
if ($lawful){ #only give good shares to lawful users <-indicative comment
$pair = $work_queue->dequeue_nb; <-confirmed code is executed only when worker is disconnecting
}
if (!$pair){
$pair=$solo_queue->dequeue;
}
$limiter->{got_works}++ if $limiter;;
my ($work, $pool_name) = @{$pair};
{
lock $work_dequeues;
$work_dequeues++;
}
logd("rpc getwork from $vars->{host} ($pool_name ".substr($work->{data}, 16, 8)." ".substr($work->{data}, 72, 8).") queue: ".$work_queue->pending."/".$WORK_QUEUE_SIZE."w ".$solo_queue->pending."so ".$submit_queue->pending."sh\n");
The rpc getwork message does appear, but only when the worker disconnects.
Again, I'm not strong with my Perl, so maybe this code is only supposed to run during disconnection, but the comment and the rest of the code implies it's removing a getwork from the internal queue and giving it to the worker. Would this be accurate?