From: <vi...@us...> - 2010-01-11 14:32:22
|
Revision: 11890 http://amsn.svn.sourceforge.net/amsn/?rev=11890&view=rev Author: vivia Date: 2010-01-11 14:32:11 +0000 (Mon, 11 Jan 2010) Log Message: ----------- Enabled option to disable keepalive per request. Disabled keepalive for ABFindAll and FindMembership, otherwise they ll need a very long time to reply and might time out. Disabled keepalive for GetProfile on all offline users because we d rather send all requests at once and finish quickly than send them serially on the same socket and have aMSN almost frozen for several minutes. If anyone knows why ABFindAll and FindMembership are so slow, or how to make the GetProfiles not freeze us, please let me know Modified Paths: -------------- trunk/amsn/addressbook.tcl trunk/amsn/pgu.tcl trunk/amsn/protocol.tcl trunk/amsn/roaming.tcl trunk/amsn/soap.tcl Modified: trunk/amsn/addressbook.tcl =================================================================== --- trunk/amsn/addressbook.tcl 2010-01-11 02:12:01 UTC (rev 11889) +++ trunk/amsn/addressbook.tcl 2010-01-11 14:32:11 UTC (rev 11890) @@ -172,6 +172,7 @@ -url $SharingServiceURL \ -action "http://www.msn.com/webservices/AddressBook/FindMembership" \ -header [$self getCommonHeaderXML Initial $ticket] \ + -keepalive 0 \ -body [$self getFindMembershipBodyXML] \ -callback [list $self FindMembershipCallback $callbk]] @@ -272,6 +273,7 @@ -action "http://www.msn.com/webservices/AddressBook/ABFindAll" \ -header [$self getCommonHeaderXML Initial $ticket] \ -body [$self getABFindAllBodyXML] \ + -keepalive 0 \ -callback [list $self ABFindAllCallback $callbk]] lappend soap_requests $request Modified: trunk/amsn/pgu.tcl =================================================================== --- trunk/amsn/pgu.tcl 2010-01-11 02:12:01 UTC (rev 11889) +++ trunk/amsn/pgu.tcl 2010-01-11 14:32:11 UTC (rev 11890) @@ -73,7 +73,7 @@ # # ::PGU::Add -- adds a url and callback command to are request queue # - proc ::PGU::Add {url cmd query type headers {nolaunch 0}} { + proc ::PGU::Add {url cmd query type headers {nolaunch 0} {keepalive 1}} { variable queue variable qtail variable stats @@ -83,7 +83,7 @@ incr stats(qlen) status_log "PGU: Queueing $id for $url : [::PGU::Status]" if {!$nolaunch} { - ::PGU::Launch + ::PGU::Launch $keepalive } return $id @@ -98,7 +98,7 @@ # # ::PGU::Launch -- launches web requests if we have the capacity # - proc ::PGU::Launch {} { + proc ::PGU::Launch {{keepalive 1}} { variable queue variable qtail variable qhead @@ -120,8 +120,8 @@ foreach {url cmd query type headers cnt} $queue($id) break status_log "PGU: Getting URL $id : [::PGU::Status]" - if {[catch {set tokens($id) [::http::geturl $url -keepalive 1 -timeout $options(-timeout) \ - -command [list ::PGU::_HTTPCommand $id] \ + if {[catch {set tokens($id) [::http::geturl $url -keepalive $keepalive -timeout $options(-timeout) \ + -command [list ::PGU::_HTTPCommand $id $keepalive] \ -query $query -type $type -headers $headers]} res]} { status_log "Error calling ::http::geturl : $res" if {[catch {eval $cmd ""} emsg]} { @@ -137,7 +137,7 @@ # ::PGU::_HTTPCommand -- our geturl callback command that handles # queue maintenance, timeout retries and user callbacks. # - proc ::PGU::_HTTPCommand {id token} { + proc ::PGU::_HTTPCommand {id keepalive token} { variable queue variable stats variable options @@ -156,9 +156,9 @@ lset queue($id) 5 $cnt ;# Remember retry attempts if {![catch { - set tokens($id) [::http::geturl $url -keepalive 1 \ + set tokens($id) [::http::geturl $url -keepalive $keepalive \ -timeout $options(-timeout) \ - -command [list ::PGU::_HTTPCommand $id] \ + -command [list ::PGU::_HTTPCommand $id $keepalive] \ -query $query -type $type \ -headers $headers] }] } { @@ -174,7 +174,7 @@ incr stats(pending) -1 ;# One less outstanding request incr stats(done) status_log "PGU: Request $id done : [::PGU::Status]" - ::PGU::Launch ;# Try launching another request + ::PGU::Launch $keepalive ;# Try launching another request ::http::cleanup $token array unset queue $id @@ -203,4 +203,4 @@ return [list $stats(qlen) $stats(pending) $stats(done) $stats(timeouts)] } -} \ No newline at end of file +} Modified: trunk/amsn/protocol.tcl =================================================================== --- trunk/amsn/protocol.tcl 2010-01-11 02:12:01 UTC (rev 11889) +++ trunk/amsn/protocol.tcl 2010-01-11 14:32:11 UTC (rev 11890) @@ -4954,7 +4954,7 @@ } foreach username [::MSN::getList FL] { - after idle [list catch [list $::roaming GetProfile [list ::MSN::roaming_cl_get_profile_cb $username] $username]] + after idle [list catch [list $::roaming GetProfile [list ::MSN::roaming_cl_get_profile_cb $username] $username 0]] } # Change status after sending the UUX stuff Modified: trunk/amsn/roaming.tcl =================================================================== --- trunk/amsn/roaming.tcl 2010-01-11 02:12:01 UTC (rev 11889) +++ trunk/amsn/roaming.tcl 2010-01-11 14:32:11 UTC (rev 11890) @@ -28,17 +28,18 @@ } - method GetProfile { callbk {email ""}} { - $::sso RequireSecurityToken Storage [list $self GetProfileSSOCB $callbk $email] + method GetProfile { callbk {email ""} {keepalive 1}} { + $::sso RequireSecurityToken Storage [list $self GetProfileSSOCB $callbk $email $keepalive] #TODO: s/Storage/MessengerSecure ? } - method GetProfileSSOCB { callbk email ticket} { + method GetProfileSSOCB { callbk email keepalive ticket} { set request [SOAPRequest create %AUTO% \ -url "https://storage.msn.com/storageservice/SchematizedStore.asmx" \ -action "http://www.msn.com/webservices/storage/w10/GetProfile" \ -header [$self getCommonHeaderXML RoamingSeed $ticket] \ -body [$self getGetProfileBodyXML $email] \ + -keepalive $keepalive \ -callback [list $self GetProfileCallback $callbk $email]] lappend soap_requests $request Modified: trunk/amsn/soap.tcl =================================================================== --- trunk/amsn/soap.tcl 2010-01-11 02:12:01 UTC (rev 11889) +++ trunk/amsn/soap.tcl 2010-01-11 14:32:11 UTC (rev 11890) @@ -14,6 +14,7 @@ option -header "" option -body "" option -ttl 5 + option -keepalive 1 variable wait 0 variable status "" @@ -41,6 +42,10 @@ if { $options(-url) == "" || ($options(-xml) == "" && ($options(-header) == "" || $options(-body) == "")) } { error "SOAPRequest incomplete" } + set keepalive 1 + if { $options(-keepalive) == 0 } { + set keepalive 0 + } status_log "Sending SOAP request to $options(-url) with action $options(-action)" green if { $options(-action) != "" } { @@ -125,7 +130,7 @@ set xml [encoding convertto utf-8 $xml] # Catch it in case we have no internet.. - if { ![catch { set http_req [::PGU::Add $options(-url) [list $self GotSoapReply] $xml "text/xml; charset=utf-8" $headers] } res] } { + if { ![catch { set http_req [::PGU::Add $options(-url) [list $self GotSoapReply] $xml "text/xml; charset=utf-8" $headers 0 $keepalive] } res] } { #puts "Sending HTTP request : $options(-url)\nSOAPAction: $options(-action)\n\n$xml" if {[info exists ::soap_debug] && $::soap_debug != ""} { set filename "[$self GetDebugFilename]_req.xml" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |