comparison common-channel.c @ 941:5daedffd0769

Set tcp priority as follows: if (connecting || ptys || x11) tos = LOWDELAY; else if (tcp_forwards) tos = 0; else tos = BULK; TCP forwards could be either lowdelay or bulk, hence the default priority.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 16 Jul 2014 22:53:32 +0800
parents c88dce72f6d2
children 2e402a09e21e
comparison
equal deleted inserted replaced
940:e9dfb6d15193 941:5daedffd0769
172 172
173 newchan->extrabuf = NULL; /* The user code can set it up */ 173 newchan->extrabuf = NULL; /* The user code can set it up */
174 newchan->recvdonelen = 0; 174 newchan->recvdonelen = 0;
175 newchan->recvmaxpacket = RECV_MAX_CHANNEL_DATA_LEN; 175 newchan->recvmaxpacket = RECV_MAX_CHANNEL_DATA_LEN;
176 176
177 newchan->prio = DROPBEAR_CHANNEL_PRIO_EARLY; /* inithandler sets it */
178
177 ses.channels[i] = newchan; 179 ses.channels[i] = newchan;
178 ses.chancount++; 180 ses.chancount++;
179 181
180 TRACE(("leave newchannel")) 182 TRACE(("leave newchannel"))
181 183
593 595
594 ses.channels[channel->index] = NULL; 596 ses.channels[channel->index] = NULL;
595 m_free(channel); 597 m_free(channel);
596 ses.chancount--; 598 ses.chancount--;
597 599
600 update_channel_prio();
601
598 TRACE(("leave remove_channel")) 602 TRACE(("leave remove_channel"))
599 } 603 }
600 604
601 /* Handle channel specific requests, passing off to corresponding handlers 605 /* Handle channel specific requests, passing off to corresponding handlers
602 * such as chansession or x11fwd */ 606 * such as chansession or x11fwd */
883 TRACE(("inithandler returned failure %d", ret)) 887 TRACE(("inithandler returned failure %d", ret))
884 goto failure; 888 goto failure;
885 } 889 }
886 } 890 }
887 891
892 if (channel->prio == DROPBEAR_CHANNEL_PRIO_EARLY) {
893 channel->prio = DROPBEAR_CHANNEL_PRIO_BULK;
894 }
895
888 chan_initwritebuf(channel); 896 chan_initwritebuf(channel);
889 897
890 /* success */ 898 /* success */
891 send_msg_channel_open_confirmation(channel, channel->recvwindow, 899 send_msg_channel_open_confirmation(channel, channel->recvwindow,
892 channel->recvmaxpacket); 900 channel->recvmaxpacket);
896 TRACE(("recv_msg_channel_open failure")) 904 TRACE(("recv_msg_channel_open failure"))
897 send_msg_channel_open_failure(remotechan, errtype, "", ""); 905 send_msg_channel_open_failure(remotechan, errtype, "", "");
898 906
899 cleanup: 907 cleanup:
900 m_free(type); 908 m_free(type);
909
910 update_channel_prio();
901 911
902 TRACE(("leave recv_msg_channel_open")) 912 TRACE(("leave recv_msg_channel_open"))
903 } 913 }
904 914
905 /* Send a failure message */ 915 /* Send a failure message */
1011 #if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT) 1021 #if defined(USING_LISTENERS) || defined(DROPBEAR_CLIENT)
1012 /* Create a new channel, and start the open request. This is intended 1022 /* Create a new channel, and start the open request. This is intended
1013 * for X11, agent, tcp forwarding, and should be filled with channel-specific 1023 * for X11, agent, tcp forwarding, and should be filled with channel-specific
1014 * options, with the calling function calling encrypt_packet() after 1024 * options, with the calling function calling encrypt_packet() after
1015 * completion. It is mandatory for the caller to encrypt_packet() if 1025 * completion. It is mandatory for the caller to encrypt_packet() if
1016 * DROPBEAR_SUCCESS is returned */ 1026 * a channel is returned. NULL is returned on failure. */
1017 int send_msg_channel_open_init(int fd, const struct ChanType *type) { 1027 int send_msg_channel_open_init(int fd, const struct ChanType *type) {
1018 1028
1019 struct Channel* chan; 1029 struct Channel* chan;
1020 1030
1021 TRACE(("enter send_msg_channel_open_init()")) 1031 TRACE(("enter send_msg_channel_open_init()"))
1080 remove_channel(channel); 1090 remove_channel(channel);
1081 TRACE(("inithandler returned failure %d", ret)) 1091 TRACE(("inithandler returned failure %d", ret))
1082 } 1092 }
1083 } 1093 }
1084 1094
1095 if (channel->prio == DROPBEAR_CHANNEL_PRIO_EARLY) {
1096 channel->prio = DROPBEAR_CHANNEL_PRIO_BULK;
1097 }
1098 update_channel_prio();
1085 1099
1086 TRACE(("leave recv_msg_channel_open_confirmation")) 1100 TRACE(("leave recv_msg_channel_open_confirmation"))
1087 } 1101 }
1088 1102
1089 /* Notification that our channel open request failed */ 1103 /* Notification that our channel open request failed */
1111 void send_msg_request_failure() { 1125 void send_msg_request_failure() {
1112 CHECKCLEARTOWRITE(); 1126 CHECKCLEARTOWRITE();
1113 buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE); 1127 buf_putbyte(ses.writepayload, SSH_MSG_REQUEST_FAILURE);
1114 encrypt_packet(); 1128 encrypt_packet();
1115 } 1129 }
1116