Skip to content

Commit

Permalink
Update Udp.php
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinceveve authored Jul 13, 2016
1 parent 9786d2a commit 3ae2710
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Rxnet/Connector/Udp.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Rxnet\Connector;

use Rx\Observable;
use Rx\ObserverInterface;
use Rxnet\Event\ConnectorEvent;
use Rxnet\Transport\Datagram;

Expand All @@ -18,9 +20,10 @@ protected function createSocketForAddress()
{
$socket = parent::createSocketForAddress();

$stream = new Datagram($socket, $this->loop);
$this->notifyNext(new ConnectorEvent('/connector/connected', $stream));
$this->notifyCompleted();
return $stream;
return Observable::create(function(ObserverInterface $observer) use($socket) {
$stream = new Datagram($socket, $this->loop);
$observer->onNext(new ConnectorEvent('/connector/connected', $stream));
$observer->onCompleted();
});
}
}

0 comments on commit 3ae2710

Please sign in to comment.