Changeset 347
- Timestamp:
- 06/01/07 12:35:49 (2 years ago)
- Files:
-
- version_0/ChangeLog (modified) (1 diff)
- version_0/ext/cmain.cpp (modified) (1 diff)
- version_0/ext/eventmachine.h (modified) (1 diff)
- version_0/ext/rubymain.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
version_0/ChangeLog
r345 r347 30 30 01Jun07: Added EM, a "pseudo-alias" for EventMachine. 31 31 01Jun07: Added EM#next_tick. 32 01Jun07: Added EM::Connection#get_outbound_data_size version_0/ext/cmain.cpp
r336 r347 304 304 305 305 306 306 /*************************** 307 evma_get_outbound_data_size 308 ***************************/ 309 310 extern "C" int evma_get_outbound_data_size (const char *binding) 311 { 312 if (!EventMachine) 313 throw std::runtime_error ("not initialized"); 314 EventableDescriptor *ed = dynamic_cast <EventableDescriptor*> (Bindable_t::GetObject (binding)); 315 return ed ? ed->GetOutboundDataSize() : 0; 316 } 317 318 version_0/ext/eventmachine.h
r336 r347 49 49 int evma_get_comm_inactivity_timeout (const char *binding, /*out*/int *value); 50 50 int evma_set_comm_inactivity_timeout (const char *binding, /*in,out*/int *value); 51 int evma_get_outbound_data_size (const char *binding); 52 51 53 void evma_close_connection (const char *binding, int after_writing); 52 54 void evma_signal_loopbreak(); version_0/ext/rubymain.cpp
r336 r347 29 29 30 30 static VALUE EmModule; 31 static VALUE EmConnection; 32 33 static VALUE Intern_at_signature; 31 34 32 35 … … 324 327 325 328 329 330 /*************************** 331 conn_get_outbound_data_size 332 ***************************/ 333 334 static VALUE conn_get_outbound_data_size (VALUE self) 335 { 336 VALUE sig = rb_ivar_get (self, Intern_at_signature); 337 return INT2NUM (evma_get_outbound_data_size (StringValuePtr(sig))); 338 } 339 340 341 326 342 /********************* 327 343 Init_rubyeventmachine … … 330 346 extern "C" void Init_rubyeventmachine() 331 347 { 348 // Tuck away some symbol values so we don't have to look 'em up every time we need 'em. 349 Intern_at_signature = rb_intern ("@signature"); 350 332 351 // INCOMPLETE, we need to define class Connections inside module EventMachine 333 352 // run_machine and run_machine_without_threads are now identical. 334 353 // Must deprecate the without_threads variant. 335 354 EmModule = rb_define_module ("EventMachine"); 355 EmConnection = rb_define_class_under (EmModule, "Connection", rb_cObject); 356 357 rb_define_class_under (EmModule, "ConnectionNotBound", rb_eException); 358 rb_define_class_under (EmModule, "NoHandlerForAcceptedConnection", rb_eException); 359 rb_define_class_under (EmModule, "UnknownTimerFired", rb_eException); 360 336 361 rb_define_module_function (EmModule, "initialize_event_machine", (VALUE(*)(...))t_initialize_event_machine, 0); 337 362 rb_define_module_function (EmModule, "run_machine", (VALUE(*)(...))t_run_machine_without_threads, 0); … … 355 380 rb_define_module_function (EmModule, "invoke_popen", (VALUE(*)(...))t_invoke_popen, 2); 356 381 357 // Provisional:382 // Provisional: 358 383 rb_define_module_function (EmModule, "_write_file", (VALUE(*)(...))t__write_file, 1); 359 384 … … 362 387 rb_define_module_function (EmModule, "set_comm_inactivity_timeout", (VALUE(*)(...))t_set_comm_inactivity_timeout, 2); 363 388 364 rb_define_class_under (EmModule, "ConnectionNotBound", rb_eException); 365 rb_define_class_under (EmModule, "NoHandlerForAcceptedConnection", rb_eException); 366 rb_define_class_under (EmModule, "UnknownTimerFired", rb_eException); 389 rb_define_method (EmConnection, "get_outbound_data_size", (VALUE(*)(...))conn_get_outbound_data_size, 0); 367 390 368 391 rb_define_const (EmModule, "TimerFired", INT2NUM(100));
