Revision: 7736 https://osdn.net/projects/ttssh2/scm/svn/commits/7736 Author: yutakapon Date: 2019-06-06 20:29:52 +0900 (Thu, 06 Jun 2019) Log Message: ----------- remote_windowに空きができて、リストの中身がすべて空になってから、local connectionの メッセージ通知を再開させるようにした。 チケット #39297 Ticket Links: ------------ https://osdn.net/projects/ttssh2/tracker/detail/39297 Modified Paths: -------------- branches/portfwd_memleak/ttssh2/ttxssh/fwd.c branches/portfwd_memleak/ttssh2/ttxssh/ssh.c -------------- next part -------------- Modified: branches/portfwd_memleak/ttssh2/ttxssh/fwd.c =================================================================== --- branches/portfwd_memleak/ttssh2/ttxssh/fwd.c 2019-06-06 10:46:13 UTC (rev 7735) +++ branches/portfwd_memleak/ttssh2/ttxssh/fwd.c 2019-06-06 11:29:52 UTC (rev 7736) @@ -740,16 +740,17 @@ } } -// local connection\x82\xA9\x82\xE7\x82̃p\x83P\x83b\x83g\x83\x8A\x81[\x83h(FD_READ)\x82̒ʒm\x82\xF0\x90\xE8\x91ւ\xA6\x82\xE9 +// local connection(WinSock)\x82\xA9\x82\xE7\x82̃\x81\x83b\x83Z\x81[\x83W\x92ʒm\x82\xF0\x90\xE8\x91ւ\xA6\x82\xE9 // -// notify: TRUE FD_READ\x82\xF0\x92ʒm\x82\xB7\x82\xE9 -// FALSE FD_READ\x82\xF0\x92ʒm\x82\xB5\x82Ȃ\xA2 +// notify: TRUE \x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x92ʒm\x82\xB7\x82\xE9 +// FALSE \x83\x81\x83b\x83Z\x81[\x83W\x82\xF0\x92ʒm\x82\xB5\x82Ȃ\xA2 // +// [\x96ړI] // remote_window\x82ɋ\xAA\x82Ȃ\xA2\x8Fꍇ\x82͒ʒm\x83I\x83t\x82Ƃ\xB5\x81A\x8B\xAA\x82ł\xAB\x82\xBD\x8Fꍇ\x82\xCD // \x92ʒm\x82\xF0\x8DĊJ\x82\xB7\x82\xE9\x81B -// // remote_window\x82ɗ]\x97T\x82\xAA\x82Ȃ\xA2\x8F\xF3\x91ԂŁAlocal connection\x82\xA9\x82\xE7\x82̃p\x83P\x83b\x83g\x82\xF0 -// \x8E\xF3\x90M\x82\xB5\x91\xB1\x82\xAF\x82\xE9\x82ƁA\x8F\xC1\x94\x83\x82\x83\x8A\x82\xAA\x94\xEC\x91剻\x82\xB7\x82\xE9\x82Ƃ\xA2\x82\xA4\x96\xE2\x91\xE8\x82\xF0\x89\xF1\x94\xF0\x82\xB7\x82\xE9\x81B +// \x8E\xF3\x90M\x82\xB5\x91\xB1\x82\xAF\x82\xE9\x82ƁA\x8F\xC1\x94\x83\x82\x83\x8A\x82\xAA\x94\xEC\x91剻\x82\xB7\x82\xE9(\x8C\xB5\x96\xA7\x82ɂ̓\x81\x83\x82\x83\x8A\x83\x8A\x81[\x83N\x82ł͂Ȃ\xA2) +// \x82Ƃ\xA2\x82\xA4\x96\xE2\x91\xE8\x82\xF0\x89\xF1\x94\xF0\x82\xB7\x82\xE9\x81B // // (2019.6.5 yutaka) void FWD_suspend_resume_local_connection(PTInstVar pvar, Channel_t* c, int notify) @@ -762,6 +763,7 @@ channel = pvar->fwd_state.channels + channel_num; if (notify) { + // \x83\x81\x83b\x83Z\x81[\x83W\x92ʒm\x82\xF0\x97L\x8C\xF8\x82ɂ\xB7\x82\xE9 ret = WSAAsyncSelect( channel->local_socket, make_accept_wnd(pvar), WM_SOCK_IO, @@ -768,6 +770,18 @@ FD_CONNECT | FD_READ | FD_CLOSE | FD_WRITE ); } else { + /* \x83\x81\x83b\x83Z\x81[\x83W\x92ʒm\x82\xF8\x82ɂ\xB7\x82\xE9\x81B + \x96\xB3\x8C\xF8\x8C\xE3\x81A\x83L\x83\x85\x81[\x82ɗ\xAD\x82܂\xC1\x82Ă\xA2\x82郁\x83b\x83Z\x81[\x83W\x82\xAA\x91\x97\x82\xE7\x82\xEA\x82Ă\xAD\x82邱\x82Ƃ\xAA\x82\xA0\x82\xE9\x82̂Œ\x8D\x88ӁB + + https://docs.microsoft.com/en-us/windows/desktop/api/winsock/nf-winsock-wsaasyncselect + To cancel all notification indicating that Windows Sockets should send no further + messages related to network events on the socket, lEvent is set to zero. + + Although WSAAsyncSelect immediately disables event message posting for the socket + in this instance, it is possible that messages could be waiting in the application + message queue. Therefore, the application must be prepared to receive network + event messages even after cancellation. + */ ret = WSAAsyncSelect( channel->local_socket, make_accept_wnd(pvar), @@ -775,7 +789,7 @@ } if (ret != 0) { - logprintf(LOG_LEVEL_ERROR, "%s: Can not change local channel(%d) notification(%d)", + logprintf(LOG_LEVEL_ERROR, "%s: Can not change local channel(%d) WinSock notification(%d).", __FUNCTION__, channel_num, notify); } Modified: branches/portfwd_memleak/ttssh2/ttxssh/ssh.c =================================================================== --- branches/portfwd_memleak/ttssh2/ttxssh/ssh.c 2019-06-06 10:46:13 UTC (rev 7735) +++ branches/portfwd_memleak/ttssh2/ttxssh/ssh.c 2019-06-06 11:29:52 UTC (rev 7736) @@ -231,6 +231,7 @@ } // remote_window\x82̋\xAA\x82Ȃ\xA2\x8Fꍇ\x82ɁA\x91\x97\x82\xEA\x82Ȃ\xA9\x82\xC1\x82\xBD\x83o\x83b\x83t\x83@\x82\xF0\x83\x8A\x83X\x83g\x81i\x93\xFC\x97͏\x87\x81j\x82ւȂ\xA2\x82ł\xA8\x82\xAD\x81B +// \x82\xB1\x82\xB1\x82Ŋm\x95ۂ\xB5\x82\xBD\x83\x81\x83\x82\x83\x8A\x82\xCD ssh2_channel_retry_send_bufchain() \x82ʼn\xF0\x95\xFA\x82\xB7\x82\xE9\x81B static void ssh2_channel_add_bufchain(PTInstVar pvar, Channel_t *c, unsigned char *buf, unsigned int buflen) { bufchain_t *p, *old; @@ -256,14 +257,18 @@ old->next = p; } + // remote_window\x82̋\xAA\x82Ȃ\xA2\x82̂ŁAlocal connection\x82\xA9\x82\xE7\x82̃p\x83P\x83b\x83g\x8E\xF3\x90M\x82\xCC + // \x92\xE2\x8E~\x8Ew\x8E\xA6\x82\xF0\x8Fo\x82\xB7\x81B\x82\xB7\x82\xAE\x82ɒʒm\x82\xAA\x8E~\x82܂\xE9\x82킯\x82ł͂Ȃ\xA2\x81B FWD_suspend_resume_local_connection(pvar, c, FALSE); } +// remote_window\x82̋\xAA\x82ł\xAB\x82\xBD\x82\xE7\x81A\x83\x8A\x83X\x83g\x82Ɏc\x82\xC1\x82Ă\xA2\x82\xE9\x83f\x81[\x83^\x82\xF0\x8F\x87\x94Ԃɑ\x97\x82\xE9\x81B +// \x91\x97\x90M\x82\xAA\x82ł\xAB\x82\xBD\x82烁\x83\x82\x83\x8A\x82\xF0\x89\xF0\x95\xFA\x82\xB7\x82\xE9\x81B static void ssh2_channel_retry_send_bufchain(PTInstVar pvar, Channel_t *c) { bufchain_t *ch; unsigned int size; - int count = 0; + bufchain_t* ch_origin = c->bufchain; while (c->bufchain) { // \x90擪\x82\xA9\x82\xE7\x90\xE6\x82ɑ\x97\x82\xE9 @@ -282,11 +287,11 @@ buffer_free(ch->msg); free(ch); - - count++; } - if (count > 0) { + // \x8C\xB3\x81X\x82\xA0\x82\xC1\x82\xBD\x83\x8A\x83X\x83g\x82\xAA\x8B\xF3\x82ɂȂ\xC1\x82\xBD\x82\xE7\x81A + // local connection\x82\xA9\x82\xE7\x82̃p\x83P\x83b\x83g\x92ʒm\x82\xF0\x8DĊJ\x82\xB7\x82\xE9\x81B + if (ch_origin && c->bufchain == NULL) { FWD_suspend_resume_local_connection(pvar, c, TRUE); } }