File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -234,13 +234,14 @@ class Connection : public ObjectWrap {
234234
235235 uv_poll_t read_watcher_;
236236 uv_poll_t write_watcher_;
237-
238237 PGconn *connection_;
239238 bool connecting_;
239+ bool ioInitialized_;
240240 Connection () : ObjectWrap ()
241241 {
242242 connection_ = NULL ;
243243 connecting_ = false ;
244+ ioInitialized_ = false ;
244245
245246 TRACE (" Initializing ev watchers" );
246247 read_watcher_.data = this ;
@@ -354,6 +355,8 @@ class Connection : public ObjectWrap {
354355 uv_poll_init (uv_default_loop (), &read_watcher_, fd);
355356 uv_poll_init (uv_default_loop (), &write_watcher_, fd);
356357
358+ ioInitialized_ = true ;
359+
357360 connecting_ = true ;
358361 StartWrite ();
359362
@@ -616,7 +619,9 @@ class Connection : public ObjectWrap {
616619 void StopWrite ()
617620 {
618621 TRACE (" Stoping write watcher" );
619- uv_poll_stop (&write_watcher_);
622+ if (ioInitialized_) {
623+ uv_poll_stop (&write_watcher_);
624+ }
620625 }
621626
622627 void StartWrite ()
@@ -628,7 +633,9 @@ class Connection : public ObjectWrap {
628633 void StopRead ()
629634 {
630635 TRACE (" Stoping read watcher" );
631- uv_poll_stop (&read_watcher_);
636+ if (ioInitialized_) {
637+ uv_poll_stop (&read_watcher_);
638+ }
632639 }
633640
634641 void StartRead ()
You can’t perform that action at this time.
0 commit comments