Permalink
Browse files

socket, bugfix: closing a socket twice will cause a crash.

  • Loading branch information...
xicilion committed Oct 25, 2017
1 parent 64e9aba commit f0459a34b86c500bcf5c44904a728871d7c15a71
Showing with 7 additions and 5 deletions.
  1. +7 −5 fibjs/src/io/AsyncIO_ev.cpp
@@ -284,14 +284,16 @@ result_t AsyncIO::close(intptr_t& s, AsyncEvent* ac)
virtual void start()
{
if (m_opt1)
((asyncProc*)m_opt1)->onready();
if (m_s != INVALID_SOCKET) {
if (m_opt1)
((asyncProc*)m_opt1)->onready();
if (m_opt2)
((asyncProc*)m_opt2)->onready();
if (m_opt2)
((asyncProc*)m_opt2)->onready();
if (m_s != INVALID_SOCKET)
::closesocket(m_s);
}
m_s = INVALID_SOCKET;
m_ac->apost(0);

0 comments on commit f0459a3

Please sign in to comment.