Comparison

net/server_select.lua @ 9579:185eed6cbab0

net.server_select: Replace use of deprecated :lock_read in server.link
author Kim Alvefur <zash@zash.se>
date Sun, 28 Oct 2018 17:08:50 +0100
parent 9578:1ef33635f3f0
child 9580:5fe91bfb734c
comparison
equal deleted inserted replaced
9578:1ef33635f3f0 9579:185eed6cbab0
717 local sender_locked; 717 local sender_locked;
718 local _sendbuffer = receiver.sendbuffer; 718 local _sendbuffer = receiver.sendbuffer;
719 function receiver.sendbuffer() 719 function receiver.sendbuffer()
720 _sendbuffer(); 720 _sendbuffer();
721 if sender_locked and receiver.bufferlen() < buffersize then 721 if sender_locked and receiver.bufferlen() < buffersize then
722 sender:lock_read(false); -- Unlock now 722 sender:resume(); -- Unlock now
723 sender_locked = nil; 723 sender_locked = nil;
724 end 724 end
725 end 725 end
726 726
727 local _readbuffer = sender.readbuffer; 727 local _readbuffer = sender.readbuffer;
728 function sender.readbuffer() 728 function sender.readbuffer()
729 _readbuffer(); 729 _readbuffer();
730 if not sender_locked and receiver.bufferlen() >= buffersize then 730 if not sender_locked and receiver.bufferlen() >= buffersize then
731 sender_locked = true; 731 sender_locked = true;
732 sender:lock_read(true); 732 sender:pause();
733 end 733 end
734 end 734 end
735 sender:set_mode("*a"); 735 sender:set_mode("*a");
736 end 736 end
737 737