File tree 1 file changed +16
-0
lines changed
1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1682,6 +1682,22 @@ def _send(self, msg):
1682
1682
pkt = struct .pack (self .HEADER_FMT , self .HEADER_MAGIC , msg .dst_id ,
1683
1683
msg .src_id , msg .auth_id , msg .handle ,
1684
1684
msg .reply_to or 0 , len (msg .data )) + msg .data
1685
+
1686
+ if not self ._output_buf_len :
1687
+ # Modifying epoll/Kqueue state is expensive, as is needless broker
1688
+ # loop iterations. Rather than wait for writeability, simply
1689
+ # attempt to write immediately, and only fall back to
1690
+ # start_transmit()/on_transmit() if an error occurred or the socket
1691
+ # buffer was full.
1692
+ try :
1693
+ n = self .transmit_side .write (pkt )
1694
+ if n :
1695
+ if n == len (pkt ):
1696
+ return
1697
+ pkt = pkt [n :]
1698
+ except OSError :
1699
+ pass
1700
+
1685
1701
if not self ._output_buf_len :
1686
1702
self ._router .broker ._start_transmit (self )
1687
1703
self ._output_buf .append (pkt )
You can’t perform that action at this time.
0 commit comments