File tree 1 file changed +10
-3
lines changed
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 {
234
234
235
235
uv_poll_t read_watcher_;
236
236
uv_poll_t write_watcher_;
237
-
238
237
PGconn *connection_;
239
238
bool connecting_;
239
+ bool ioInitialized_;
240
240
Connection () : ObjectWrap ()
241
241
{
242
242
connection_ = NULL ;
243
243
connecting_ = false ;
244
+ ioInitialized_ = false ;
244
245
245
246
TRACE (" Initializing ev watchers" );
246
247
read_watcher_.data = this ;
@@ -354,6 +355,8 @@ class Connection : public ObjectWrap {
354
355
uv_poll_init (uv_default_loop (), &read_watcher_, fd);
355
356
uv_poll_init (uv_default_loop (), &write_watcher_, fd);
356
357
358
+ ioInitialized_ = true ;
359
+
357
360
connecting_ = true ;
358
361
StartWrite ();
359
362
@@ -616,7 +619,9 @@ class Connection : public ObjectWrap {
616
619
void StopWrite ()
617
620
{
618
621
TRACE (" Stoping write watcher" );
619
- uv_poll_stop (&write_watcher_);
622
+ if (ioInitialized_) {
623
+ uv_poll_stop (&write_watcher_);
624
+ }
620
625
}
621
626
622
627
void StartWrite ()
@@ -628,7 +633,9 @@ class Connection : public ObjectWrap {
628
633
void StopRead ()
629
634
{
630
635
TRACE (" Stoping read watcher" );
631
- uv_poll_stop (&read_watcher_);
636
+ if (ioInitialized_) {
637
+ uv_poll_stop (&read_watcher_);
638
+ }
632
639
}
633
640
634
641
void StartRead ()
You can’t perform that action at this time.
0 commit comments