if (from_client) {
smbd_lock_socket(sconn);
- if (lp_async_smb_echo_handler() && !fd_is_readable(fd)) {
- DEBUG(10,("the echo listener was faster\n"));
- smbd_unlock_socket(sconn);
- return;
+ if (lp_async_smb_echo_handler()) {
+
+ if (fd_is_readable(sconn->smb1.echo_handler.trusted_fd)) {
+ /*
+ * This is the super-ugly hack to
+ * prefer the packets forwarded by the
+ * echo handler over the ones by the
+ * client directly
+ */
+ fd = sconn->smb1.echo_handler.trusted_fd;
+ } else if (!fd_is_readable(fd)) {
+ DEBUG(10,("the echo listener was faster\n"));
+ smbd_unlock_socket(sconn);
+ return;
+ }
}
/* TODO: make this completely nonblocking */