From 879eaf77babef13084b95ef170742958d90389b6 Mon Sep 17 00:00:00 2001 From: fcolin Date: Mon, 6 Jul 2009 10:39:28 +0000 Subject: ajout IvyChangeMsg correction pb latence TCP_NODELAY --- Ivy/Ivy.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'Ivy/Ivy.cxx') diff --git a/Ivy/Ivy.cxx b/Ivy/Ivy.cxx index 4564c6f..16b76b1 100644 --- a/Ivy/Ivy.cxx +++ b/Ivy/Ivy.cxx @@ -204,6 +204,28 @@ void Ivy::UnbindMsg(int id) } +void Ivy::ChangeBindMsg(int id, const char *regexp, ...) +{ + char buffer[4096]; + char buffer2[8192]; + va_list args; + + va_start( args, regexp ); /* Initialize variable arguments. */ + _vsnprintf_s( buffer, sizeof(buffer), sizeof(buffer)-1, regexp, args ); + va_end( args); + + SubstituteInterval( buffer, buffer2, sizeof( buffer2 ) ); + regexp_out[ id ] = buffer2; + /* send to already connected */ + IvyApplicationList::iterator iter; + for ( iter = applications.begin() ; iter != applications.end() ; ++iter ) + { + IvyApplication *app = *iter; + app->SendMsg(IvyApplication::AddRegexp, id, buffer2 ); + } + +} + void Ivy::BindDirectMsg(IvyDirectMessageCallback *callback) { direct_callback = callback; @@ -230,6 +252,10 @@ void Ivy::AddApplication(IvyApplication *app) } applications.push_back( app ); LeaveCriticalSection( &m_application_cs ); + // put the socket in NOdelay , disable Nagle's Algorithm + // we want Ivy Send message Immediately + int flag=1; + int err = app->SetSockOpt( TCP_NODELAY, &flag, sizeof(flag) ); SendSubscriptions( app ); } void Ivy::RemoveApplication(IvyApplication * app) -- cgit v1.1