Add verbose, and fix cursor movement problem

This commit is contained in:
Keith Winstein
2011-08-14 00:09:52 -04:00
parent 90687448e0
commit cc07d4cf17
5 changed files with 21 additions and 6 deletions
+10 -2
View File
@@ -15,7 +15,8 @@ Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState
assumed_receiver_state( sent_states.begin() ),
received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
last_receiver_state( initial_remote ),
fragments()
fragments(),
verbose( false )
{
/* server */
}
@@ -30,7 +31,8 @@ Transport<MyState, RemoteState>::Transport( MyState &initial_state, RemoteState
assumed_receiver_state( sent_states.begin() ),
received_states( 1, TimestampedState<RemoteState>( timestamp(), 0, initial_remote ) ),
last_receiver_state( initial_remote ),
fragments()
fragments(),
verbose( false )
{
/* client */
}
@@ -300,5 +302,11 @@ void Transport<MyState, RemoteState>::send_in_fragments( string diff, uint64_t n
string s = inst.tostring();
connection.send( s, send_timestamp );
if ( verbose ) {
fprintf( stderr, "Sent [%d=>%d] frag %d, ack=%d, throwaway=%d, len=%d\n",
(int)inst.old_num, (int)inst.new_num, (int)inst.fragment_num,
(int)inst.ack_num, (int)inst.throwaway_num, (int)inst.diff.size() );
}
} while ( !diff.empty() );
}
+4
View File
@@ -109,6 +109,8 @@ namespace Network {
FragmentAssembly fragments;
bool verbose;
public:
Transport( MyState &initial_state, RemoteState &initial_remote );
Transport( MyState &initial_state, RemoteState &initial_remote,
@@ -132,6 +134,8 @@ namespace Network {
uint64_t get_remote_state_num( void ) { return received_states.back().num; }
int fd( void ) { return connection.fd(); }
void set_verbose( void ) { verbose = true; }
};
}
+2
View File
@@ -118,6 +118,8 @@ void serve( int host_fd )
Network::UserStream blank;
Network::Transport< Terminal::Complete, Network::UserStream > network( terminal, blank );
network.set_verbose();
printf( "key= %s port= %d\n", network.get_key().c_str(), network.port() );
/* prepare to poll for events */
+2 -3
View File
@@ -112,7 +112,7 @@ void client( const char *ip, int port, const char *key )
return;
}
/* XXX transmit initial resize */
/* XXX transmit initial resize and initialize */
/* local state */
Terminal::Complete terminal( window_size.ws_col, window_size.ws_row );
@@ -180,8 +180,7 @@ void client( const char *ip, int port, const char *key )
if ( (pollfds[ 0 ].revents | pollfds[ 1 ].revents)
& (POLLERR | POLLHUP | POLLNVAL) ) {
perror( "poll" );
// break;
break;
}
}
}
+3 -1
View File
@@ -155,7 +155,9 @@ namespace Terminal {
bool operator==( const DrawState &x ) const
{
/* XXX other fields not necessary to compare -- for now */
return ( width == x.width ) && ( height == x.height ) && ( renditions == x.renditions );
return ( width == x.width ) && ( height == x.height ) && ( cursor_col == x.cursor_col )
&& ( cursor_row == x.cursor_row ) && ( cursor_visible == x.cursor_visible ) &&
( reverse_video == x.reverse_video ) && ( renditions == x.renditions );
}
};