Skip to content

Commit b7e4d9e

Browse files
committed
add notify for new slot, allow submitting net msg through manager
1 parent 0f21ae5 commit b7e4d9e

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

pc/manager.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ void manager_sub::on_add_symbol( manager *, price * )
4141
{
4242
}
4343

44+
void manager_sub::on_slot_publish( manager * )
45+
{
46+
}
47+
4448
///////////////////////////////////////////////////////////////////////////
4549
// manager
4650

@@ -738,6 +742,16 @@ void manager::on_response( rpc::get_slot *res )
738742
if ( do_cap_ ) {
739743
cap_.flush();
740744
}
745+
746+
if (
747+
has_status( PC_PYTH_RPC_CONNECTED )
748+
//&& ! hconn_.get_is_err()
749+
//&& ( ! wconn_ || ! wconn_->get_is_err() )
750+
) {
751+
if ( sub_ ) {
752+
sub_->on_slot_publish( this );
753+
}
754+
}
741755
}
742756

743757
void manager::on_response( rpc::get_recent_block_hash *m )
@@ -802,11 +816,16 @@ void manager::submit( request *req )
802816
plist_.add( req );
803817
}
804818

819+
void manager::submit( net_wtr& msg )
820+
{
821+
tconn_.add_send( msg );
822+
}
823+
805824
void manager::submit( tx_request *req )
806825
{
807826
net_wtr msg;
808827
req->build( msg );
809-
tconn_.add_send( msg );
828+
submit( msg );
810829
}
811830

812831
bool manager::submit_poll( request *req )

pc/manager.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ namespace pc
4141

4242
// on addition of new symbols
4343
virtual void on_add_symbol( manager *, price * );
44+
45+
// on new slot for publish
46+
virtual void on_slot_publish( manager * );
4447
};
4548

4649
// pyth-client connection management and event loop
@@ -130,6 +133,7 @@ namespace pc
130133

131134
// submit pyth client api request
132135
void submit( request * );
136+
void submit( net_wtr& );
133137
void submit( tx_request * );
134138

135139
// submit pyth client api request and poll until finished

0 commit comments

Comments
 (0)