| 3114 | static void processResponse500 (Connection cxn, char *response) |
| 3115 | { |
| 3116 | ArtHolder artHolder ; |
| 3117 | |
| 3118 | if (!cxn->doesStreaming) |
| 3119 | { |
| 3120 | /* we got a 500 answer in response to IHAVE */ |
| 3121 | if (!(cxn->state == cxnFlushingS || |
| 3122 | cxn->state == cxnFeedingS || |
| 3123 | cxn->state == cxnClosingS)) |
| 3124 | { |
| 3125 | syslog (LOG_ERR,CXN_BAD_STATE,hostPeerName (cxn->myHost), |
| 3126 | cxn->ident,stateToString (cxn->state)) ; |
| 3127 | cxnSleepOrDie (cxn) ; |
| 3128 | return ; |
| 3129 | } |
| 3130 | |
| 3131 | ASSERT (cxn->articleQTotal == 1) ; |
| 3132 | ASSERT (cxn->checkRespHead != NULL) ; |
| 3133 | VALIDATE_CONNECTION (cxn) ; |
| 3134 | |
| 3135 | cxn->articleQTotal-- ; |
| 3136 | cxn->checksRefused++ ; |
| 3137 | |
| 3138 | artHolder = cxn->checkRespHead ; |
| 3139 | cxn->checkRespHead = NULL ; |
| 3140 | |
| 3141 | if (cxn->articleQTotal == 0) |
| 3142 | cxnIdle (cxn) ; |
| 3143 | |
| 3144 | hostArticleNotWanted (cxn->myHost, cxn, artHolder->article) ; |
| 3145 | delArtHolder (artHolder) ; |
| 3146 | return; |
| 3147 | } |
| 3148 | |
| 3149 | /* We are streaming, so the 500 is either a reply to |
| 3150 | CHECK or TAKETHIS */ |
| 3151 | if (!(cxn->state == cxnFlushingS || |
| 3152 | cxn->state == cxnFeedingS || |
| 3153 | cxn->state == cxnClosingS)) |
| 3154 | { |
| 3155 | syslog (LOG_ERR,CXN_BAD_STATE,hostPeerName (cxn->myHost), |
| 3156 | cxn->ident,stateToString (cxn->state)) ; |
| 3157 | cxnSleepOrDie (cxn) ; |
| 3158 | return ; |
| 3159 | } |
| 3160 | |
| 3161 | VALIDATE_CONNECTION (cxn) ; |
| 3162 | |
| 3163 | /* CHECK */ |
| 3164 | if (cxn->checkRespHead != NULL) |
| 3165 | { |
| 3166 | cxn->checksRefused++ ; |
| 3167 | artHolder = cxn->checkRespHead ; |
| 3168 | remArtHolder (artHolder, &cxn->checkRespHead, &cxn->articleQTotal) ; |
| 3169 | if (cxn->articleQTotal == 0) |
| 3170 | cxnIdle (cxn) ; |
| 3171 | hostArticleNotWanted (cxn->myHost, cxn, artHolder->article); |
| 3172 | delArtHolder (artHolder) ; |
| 3173 | } |
| 3174 | /* TAKETHIS */ |
| 3175 | else if (cxn->takeRespHead != NULL) |
| 3176 | { |
| 3177 | cxn->takesRejected++ ; |
| 3178 | artHolder = cxn->takeRespHead ; |
| 3179 | remArtHolder (artHolder, &cxn->takeRespHead, &cxn->articleQTotal) ; |
| 3180 | /* Some(?) hosts return the 500 response even before we're done |
| 3181 | sending */ |
| 3182 | if (cxn->articleQTotal == 0 && !writeIsPending(cxn->myEp)) |
| 3183 | cxnIdle (cxn) ; |
| 3184 | hostArticleRejected (cxn->myHost, cxn, artHolder->article) ; |
| 3185 | delArtHolder (artHolder) ; |
| 3186 | } |
| 3187 | else |
| 3188 | { |
| 3189 | syslog (LOG_NOTICE,BAD_RESPONSE, |
| 3190 | hostPeerName (cxn->myHost),cxn->ident,438) ; |
| 3191 | cxnSleepOrDie (cxn) ; |
| 3192 | return ; |
| 3193 | } |
| 3194 | |
| 3195 | } |